In earlier Android versions, JNI:NewStringUTF
used to give an error when passed a valid UTF-8 string with 4 bytes encoding:
input is not valid Modified UTF-8
It was due to the fact that JNI/Java uses modified UTF-8. There are plenty of posts here highlighting the issue.
However, I accidentally discovered that in recent Android versions, NewStringUTF
accepts the same string which was causing a problem earlier. I tested on Android 31. I tried multiple strings and all of them worked. Below is a hex dump of one such string:
000000: e2 98 ba f0 9f 98 8a f0 9f 98 80 f0 9f 98 81 f0 ................000010: 9f 98 82 f0 9f 98 83 f0 9f 98 84 f0 9f 98 af f0 ................000020: 9f 98 89 f0 9f 98 88 f0 9f 98 87 ...........
Has something changed?