[fpc-pascal] android JNI JString to String
Jonas Maebe
jonas.maebe at elis.ugent.be
Tue Apr 26 13:53:39 CEST 2011
On 26 Apr 2011, at 13:06, herux wrote:
> I debug this line of code using android log
>
> Chars := Env^.GetStringChars(Env, AJString, nil);
> __android_log_write(ANDROID_LOG_DEBUG,'proj_debug',PChar(Chars));
>
> and the log I retrieved :
>
> 04-26 17:53:17.942: DEBUG/proj_debug(711): e <--- only "e" character
That is normal, because Chars is probably an array of jchar, and a
jchar is utf-16 (= widechar). That means that if you treat it as pchar
and it only contains plain ASCII, the second "ansichar" will always be
#0 on a little endian system (on a big endian system, the first
"ansichar" will already be #0).
Jonas
More information about the fpc-pascal
mailing list