Browse Source

fix charset when get string length

pull/597/head
Tao Guo 3 years ago committed by Tao Guo
parent
commit
d25ebe39ca
  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