Skip to content

Commit bfbfdfc

Browse files
committed
fixing the issue of translating the non english language data
1 parent ffc372e commit bfbfdfc

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

android/src/main/java/com/RNFetchBlob/RNFetchBlobReq.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -514,11 +514,13 @@ private void done(Response resp) {
514514
String utf8 = new String(b);
515515
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_UTF8, utf8);
516516
}
517-
// This usually mean the data is contains invalid unicode characters, it's
518-
// binary data
517+
// This usually mean the data is contains invalid unicode characters but still valid data,
518+
// it's binary data, so send it as a normal string
519519
catch(CharacterCodingException ignored) {
520+
520521
if(responseFormat == ResponseFormat.UTF8) {
521-
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_UTF8, "");
522+
String utf8 = new String(b);
523+
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_UTF8, utf8);
522524
}
523525
else {
524526
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_BASE64, android.util.Base64.encodeToString(b, Base64.NO_WRAP));

0 commit comments

Comments
 (0)