Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

Commit

Permalink
Fix incorrect UTF-8 data conversion issue when the data contains spec…
Browse files Browse the repository at this point in the history
…ial characters.
  • Loading branch information
wkh237 committed Jun 20, 2017
1 parent 4073093 commit 1d4e69c
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions android/src/main/java/com/RNFetchBlob/RNFetchBlobFS.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,7 @@ public void readStream(String path, String encoding, int bufferSize, int tick, f
CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder();
while ((cursor = fs.read(buffer)) != -1) {
encoder.encode(ByteBuffer.wrap(buffer).asCharBuffer());
String chunk = new String(buffer);
if(cursor != bufferSize) {
chunk = chunk.substring(0, cursor);
}
String chunk = new String(buffer, 0, cursor);
emitStreamEvent(streamId, "data", chunk);
if(tick > 0)
SystemClock.sleep(tick);
Expand Down

0 comments on commit 1d4e69c

Please sign in to comment.