Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sinhala Locale

 
Nuwan Priyadarshana
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to use sinhala(Sri Lanka) locale with java, I have install sinhala Unicode fonts in my pc and try it use with properties file(I have map key in English and value in sinhala) it display unknown character, when I change the value to Unicode value instead of character(like that \u0DD9) it display correctly, so Its cumbersome way, Can I use sinhala character in normal way(without using \u0DD9) ? And how can I do that?
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to Java Ranch, Nuwan.

The problem is the editor you are using to edit the properties file. Your editor evidently does not support this encoding.

Maybe you can prove altering the file in another editors that supports it. I would like to make you a few suggestions, but it is difficult for me to prove your encoding in this moment.

My I ask what editor are you using to alter the properties file?
[ July 25, 2006: Message edited by: Edwin Dalorzo ]
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java's standard Properties file format only allows ASCII and Unicode escapes. However, assuming you have some way of editing a file in Sinhala using some other encoding, you can convert that file to ASCII + Unicode escapes using the native2ascii tool included in your JDK. Or, you can use Properties.loadFromXML() and storeToXML() (available in JDK 1.5+) to work with an XML-based Properties format, which allows you to use UTF-8 or other encodings.
 
Nuwan Priyadarshana
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks all for reply,
I have use notepad to create my properties file, when I save there is option in notepad to select Encoding and I am select as UTF-8. This is the way I have done.

I have notice this kind of properties file (using Unicode hex-value) in apache tomcat (<tomcat_home>/common/i18n/tomcat-i18n-ja.jar file).

Please let me know why this happen and how to solve the problem?

Thanks
Nuwan
 
Paul Clapham
Sheriff
Pie
Posts: 20188
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Nuwan Priyadarshana:
I have use notepad to create my properties file, when I save there is option in notepad to select Encoding and I am select as UTF-8. This is the way I have done.
If your properties file is in the XML format then you can use any encoding you like, although UTF-8 is almost always the best choice.

If your properties file is in the original text format, then its encoding MUST be ISO-8859-1. In this case you can put in the Unicode escapes manually (which you don't like to do) or use the "native2ascii" tool, as Jim Yingst already suggested.

Now, I know you didn't follow the link he posted, because it's broken and you didn't say anything about that. Here is the correct link. If you want to know how to solve the problem, the answer is there for you to read.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Paul C]: Now, I know you didn't follow the link he posted, because it's broken and you didn't say anything about that.

I was... ummm... testing him. Yeah, that's it!

Thanks for the catch, Paul.
 
Nuwan Priyadarshana
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all.

I have followed the link suggested by Jim and I got a page not found error and I try this http://java.sun.com/j2se/1.5.0/docs/tooldocs/ and then click the Internationalization Tools (native2ascii) link. I have use native2ascii tool as they said but it's not solve my problem so I am still waiting for solution. I think problem may be JVM yet not support si (Sinhala locale).Please help to solve the problem.

Thanks

Nuwan
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic