Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle unicode in webview events. #3386

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tdomhan
Copy link

@tdomhan tdomhan commented Dec 18, 2024

The request header does not support unicode characters leading to Type: error when calling setRequestHeader with a non-ascii string. This PR first encodes the data using base64 before setting the header. The downside is that this increases the content size by 33%.

This addresses #3125

Running the build updates all Javascript files. I assume this is due to the Typescript version. I'm using 5.7.2. Let me know if I should be using a specific version.

@jkelleyrtp
Copy link
Member

Wow, thanks for the quick fix! Do we need to do base64 encoding? Is there a chance that our mime-type is just not set properly on the XHR request that we can fix by using text/plain;charset=UTF-8 as the mime-type?

@tdomhan
Copy link
Author

tdomhan commented Dec 18, 2024

I'll double check. In my initial attempts I wasn't able to get this work without the base64 workaround, but indeed if this could be avoided that'd be great and I hadn't changed the mime-type yet.

@tdomhan
Copy link
Author

tdomhan commented Dec 18, 2024

I tried setting the mime type to text/plain;charset=UTF-8 but run into the same issue. From what I'm gathering this would only affect the body and the header only allows ISO-8859-1.

@jkelleyrtp
Copy link
Member

Ah good point, we had to switch to the header from the body since wry was stripping the body on android. I'll check and see if that's still the case...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants