Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to convert C++ Unicode to jstring

843829Feb 18 2003 — edited Feb 18 2003
I am using Microsoft Visual C++ and need to convert a Unicode string to a jstring to pass back to java.

I know I can do the following:

LPWSTR ustr = ...

const char *str = W2A(ustr);
jstring jstr = env->NewStringUTF(str);

But by doing this I am converting from Unicode->Ascii->Unicode. Is there some way to do this without going to Ascii?

Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 18 2003
Added on Feb 18 2003
2 comments
774 views