Skip to content

Commit 831092a

Browse files
authored
Fix crash when streaming file with Arabic chars
See: https://developer.android.com/reference/java/nio/charset/Charset.html#defaultCharset() > Android note: The Android platform default is always UTF-8.
1 parent d8c79f6 commit 831092a

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
import com.facebook.react.modules.core.DeviceEventManagerModule;
2222

2323
import java.io.*;
24-
import java.nio.ByteBuffer;
2524
import java.nio.charset.Charset;
26-
import java.nio.charset.CharsetEncoder;
2725
import java.security.MessageDigest;
2826
import java.util.ArrayList;
2927
import java.util.HashMap;
@@ -325,9 +323,7 @@ else if(resolved == null) {
325323
boolean error = false;
326324

327325
if (encoding.equalsIgnoreCase("utf8")) {
328-
CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder();
329326
while ((cursor = fs.read(buffer)) != -1) {
330-
encoder.encode(ByteBuffer.wrap(buffer).asCharBuffer());
331327
String chunk = new String(buffer, 0, cursor);
332328
emitStreamEvent(streamId, "data", chunk);
333329
if(tick > 0)

0 commit comments

Comments
 (0)