-
Notifications
You must be signed in to change notification settings - Fork 787
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
(Android) Fix UTF-8 related crashes #353
Conversation
See: https://developer.android.com/reference/java/nio/charset/Charset.html#defaultCharset() > Android note: The Android platform default is always UTF-8.
See: https://developer.android.com/reference/java/nio/charset/Charset.html#defaultCharset() > Android note: The Android platform default is always UTF-8.
FWIW, this works for any multi-byte UTF-8 on Android--Chinese, Japanese, Polish, symbols, etc. (we were seeing the same bug, this PR branch fixed the problem) |
is this PR tested well ? Should i merge it into https://github.com/Frekansapp/rn-fetch-blob here? |
This seems to have caused a regression, more info described in #442 |
I've reverted the merge of this PR and published a new version. If a new PR can be opened that fixes UTF-8 related crashes without breaking base 64 responses then I'd be glad to take another look! |
That's unfortunate, I suspect specifying the encoding explicitly when calling fetch should work but either way it's still a regression so makes sense to have reverted this. I don't have time to look at this for the foreseeable so if someone else wants to take it on, feel free! |
See: https://developer.android.com/reference/java/nio/charset/Charset.html#defaultCharset()
Before this change, the following Exception would be thrown when streaming a file containing Arabic characters:
Fixes: #297
Gave it a quick manual test a json file containing Arabic using:
and the json was logged correctly.
For the file stream change, again I tested this manually with a of react-native-local-mongodb I'm working on which loads data from files. Occasionally with a large enough file the app can hit OOM so I'm introducing streaming to reduce the likelihood of this. After this change the app now loads again.