You will need to convert std :: basic_string to UTF-8. See what your wstring -> string conversion does.
Sun has a JNI tutorial that shows how to convert char * to jstring (using some UTF conversion procedures). You can use the string wstring-> and then pass string.c_str () to the NewStringUTF function:
Unverified code:
JNIEXPORT jstring JNICALL StringTest(JNIEnv *env) { const char* test = "something"; return env->NewStringUTF(test); }
Tim finer
source share