|
|
|
|
514
|
String utf8 = new String(b);
|
514
|
String utf8 = new String(b);
|
515
|
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_UTF8, utf8);
|
515
|
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_UTF8, utf8);
|
516
|
}
|
516
|
}
|
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
|
519
|
catch(CharacterCodingException ignored) {
|
519
|
catch(CharacterCodingException ignored) {
|
|
|
520
|
+
|
520
|
if(responseFormat == ResponseFormat.UTF8) {
|
521
|
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);
|
522
|
}
|
524
|
}
|
523
|
else {
|
525
|
else {
|
524
|
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_BASE64, android.util.Base64.encodeToString(b, Base64.NO_WRAP));
|
526
|
callback.invoke(null, RNFetchBlobConst.RNFB_RESPONSE_BASE64, android.util.Base64.encodeToString(b, Base64.NO_WRAP));
|