Browse Source

Merge pull request #597 from gt945/master

fix charset when get string length
pull/599/head
Eric Kok 3 years ago committed by GitHub
parent
commit
4feae97401
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/src/main/java/se/dimovski/rencode/RencodeOutputStream.java

2
app/src/main/java/se/dimovski/rencode/RencodeOutputStream.java

@ -212,7 +212,7 @@ public class RencodeOutputStream extends FilterOutputStream implements DataOutpu @@ -212,7 +212,7 @@ public class RencodeOutputStream extends FilterOutputStream implements DataOutpu
* Writes a {@link String}
*/
public void writeString(String value) throws IOException {
int len = value.getBytes().length;
int len = value.getBytes(charset).length;
if (len < TypeCode.EMBEDDED.STR_COUNT) {
write(TypeCode.EMBEDDED.STR_START + len);
} else {

Loading…
Cancel
Save