c - Efficient way to convert n bytes of multibyte characters to unicode -
in native code of android app, need convert n bytes of multibyte characters wchar characters. unfortunately, appears android not implement mbsnrtowcs() method.
i cannot put nul
character @ end of n bytes. otherwise, have used mbstowcs().
one possibility allocate (n+1) bytes in temporary location, copy initial src in it, put null @ end, , call mbstowcs().
i wondering if has more efficient way achieve this. regards.
jni provides many string functions convert between unicode , char arrays. stay safer if stick them instead of using other functions.
for example should able use getstringchars bytes representing string in modified utf-8 encoding.
const jchar * getstringchars(jnienv *env, jstring string, jboolean *iscopy);
jchar 16-bit, guess should correspond wchar
.
Comments
Post a Comment