1 questions
In order to enhance the security of the software, the HTTP request is encapsulated in JNI, that is, the HTTP request is implemented through the C language, and the string is returned. However, strings often contain Chinese, and when the return type is jstring, the JNI warning:illegal continuation byte 0xd0 error occurs because the C file in Jni has Chinese and Chinese cannot be recognized. Unable to use (*env)->newstringutf (env,s); return string.
2. The programme
2.1 The native method returns a type of byte array such as: Private native byte[] GetData ();
2.2 Implement HTTP request, data is saved in char*p;
2.3 New byte array Jbytearray array= (*env)->newbytearray (env, Len);
2.4 (*env)->setbytearrayregion (env,array,0,len,p), and finally returns an array
2.5 Convert bytes to strings in Java code, note encoding type byte[] S=getdata (); String Str=new string (S, "GB2312");
Next, you can return the Chinese data and then parse the data further.