NewStringUTF conversion of euro character
From: Hicks (hicks_at_bigmailbox.net)
Date: 06/30/04
- Next message: Andrew Thompson: "Re: Need to display an HTML page from background thread"
- Previous message: Nigel Wade: "Re: anti-spam measures"
- Next in thread: Roedy Green: "Re: NewStringUTF conversion of euro character"
- Reply: Roedy Green: "Re: NewStringUTF conversion of euro character"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Jun 2004 02:35:26 -0700
This is a JNI question related to C/Java. I'm using j2sdk1.4.2_03.
I have a string containing a euro character € and I'm using
NewStringUTF to convert it from a native char* into a jstring. However
when the jstring is passed from the C code into a Java method, the
euro character has been converted into a '?' character.
As a test, I tried calling GetStringUTFChars in the C code to see if
the string could be converted back to a char*, and the returned value
seems to have an extra character inserted before the euro symbol (see
output).
Does anyone have any experience with this, or can offer advice on
what's happening?
proEAI_Debug (EAIDBG_PROC, "EAI_JAVA: EAIRun_Call() - Tokenized field
info is: %s", results);
resultJString = (*javaEnv)->NewStringUTF(javaEnv, (const char *)
results);
utf_string = (*javaEnv)->GetStringUTFChars(javaEnv, resultJString,
&isCopy);
proEAI_Debug (EAIDBG_PROC, "EAI_JAVA: EAIRun_Call() - utf_string =
%s", utf_string);
---------------------------- Output ----------------------------------
040629171739.474712:x004: EAI_JAVA: EAIRun_Call() - Tokenized field
info is: NAME2F07TEXTMEMA200MAXLENDDDDDDDD2A200NAMETAX1MF08NAMETAX1A200AMEMOF01ATEXTA200test1€
040629171739.474893:x004: EAI_JAVA: EAIRun_Call() - utf_string =
NAME2F07TEXTMEMA200MAXLENDDDDDDDD2A200NAMETAX1MF08NAMETAX1A200AMEMOF01ATEXTA200test1€
- Next message: Andrew Thompson: "Re: Need to display an HTML page from background thread"
- Previous message: Nigel Wade: "Re: anti-spam measures"
- Next in thread: Roedy Green: "Re: NewStringUTF conversion of euro character"
- Reply: Roedy Green: "Re: NewStringUTF conversion of euro character"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]