break 4000 words maybe error for Chinese character
byte[] bytes = message.getBytes();
int length = bytes.length;
...
for (int i = 0; i < length; i += CHUNK_SIZE) {
int count = Math.min(length - i, CHUNK_SIZE);
one chinese character may be 2 or 3 bytes in UTF-8. if the 4000th character is chinese char with 2 bytes, the char will be split. so the log cann't show the char correctly.
See this issue by accident…… if you're still in trouble of this, maybe another log library Android-PLog may help you.:smile:
@pscj Thanks for this issue, I'll definitely take a look for this. A good case! I'll add this one in backlog
@pscj I'll add this issue with the upcoming version. It'll be interesting.
i have the same confusion,and i resolve it like this
private void method3(String message){
String tmp = "";
for(int i = 0; i < message.length(); i++){
char c = message.charAt(i);
String add = tmp + c;
if(add.getBytes().length <= CHUNK_SIZE){
tmp += c;
} else {
Log.i("tag_3", i + " --> " + tmp + " --> " + tmp.getBytes().length);
tmp = c + "";
}
}
if(tmp.length() != 0){
Log.i("tag_3", tmp + " --> " + tmp.getBytes().length);
}
}
maybe it's inefficient,but who care this when print the log.