google / jni-bind

JNI Bind is a set of advanced syntactic sugar for writing efficient correct JNI Code in C++17 (and up).

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LocalString with null values in string originated from native are broken

jwhpryor opened this issue · comments

Additional context in CL description:
ff9c084

Unfortunately, I think this is unsupportable. I experimented with this a bit, and I notice when I print a java String "A\0BC\0" originated from Java in native, it prints A�BC�.

This looks like a unicode specials character for "unrepresentable".

Furthermore, the NewStringUTF JNI call does not allow for providing a length.

Because of these two things, I'm unfortunately inclined to think this is just not possible from native JNI.

I guess I missed #194 where it looks like maybe you actually do have a fix. I wish I'd noticed that earlier, as it would seem I clearly didn't understand the locale issues well enough.

The referenced CL is actually WAII. I've added some context in #194. I think this can be marked as obsolete.