Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> 958982

Pages: 1
Rahulg
Unregistered




Can not read japanese text from props files
      #39372 - 10/20/06 06:30 PM

Hi,
With Struts I am unable to read Japanese text that is in readable format. It shows garbaled characters when I put some Japanese string in the properties file.
But the japenese text in unicode format is displayed fine. it works fine with the below text: \u306b\u306a\u308a\u307e\u3059\u3002
Is it that Struts can read only the text in unnicode format and not the readable format.
Could anyone please help me on this one?
Thanks and regards,
Rahul


Post Extras: Print Post   Remind Me!   Notify Moderator  
Rahulg
Unregistered




Re: Can not read japanese text from props files [Re: Rahulg]
      #39373 - 10/20/06 07:56 PM

I guess I have got the answer. Till jdk1.5 the ResourceBundle is capable of reading the the properties files onlly in unicode. Below is the excerpt from an article from sun's website:
"
You'll need to understand another caveat regarding property bundles; you must create them in ASCII, or use Unicode escape codes to represent Unicode characters. Since you don't compile a property file to byte codes, there is no way to tell the Java1 Virtual Machine (JVM) which character set to use. So you must explicitly stick with ASCII or use the escape sequences. You can represent a Unicode character in any Java file using \uXXXX, where XXXX is the hexidecimal representation of the character. If you don't know the hexidecimal value for a character, just use the native2ascii tool provided in the JDK. This tool will convert a file written in your native encoding to one that represents non-ASCII characters as Unicode escape sequences."


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 7344

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5