You can create and edit the property files saving them in UTF-8. Then you convert the UTF-8 into the format java expects eg \uXXXX using the native2ascii program that comes with Java.

It will create a new file so the created files are what go into your application, leaving your source files in UTF-8. I use an ANT task to do this for me automatically:

<native2ascii encoding="UTF-8" src="${project.build.src}" dest="${project.build.output}">
<include name="**/*.*"/>
<exclude name="**/*.java"/>
</native2ascii>


Here are the Java Docs for native2ascii:
http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/native2ascii.html

So this should work
native2ascii -encoding UTF-8 file1.source file1.properties


Debashish Chakrabarty wrote:


Hi,

I have a query and request you to kindly spare some time to enlighten me.

I am making a web application that would translate words from English to various Indian languages using Struts. The application would not use any database so I must use some flat file to store the translation in form of English_word = Hindi_meaning (name value pair or some other form). There would be 11 Indian languages apart from Hindi. Since Java Property files are used in application localization I was of the opinion that they could easily be used to store this data (for eg. a property file State.propeties might store the names of Indian states in Hindi ex: Delhi= ??????). The value is written in Hindi unicode here, a Hindi Unicode font is available here for free download.

Important point is: My language data (the value for english keys) would be in Unicode, as above. I understand that the default encoding of the property file is not Unicode. So while saving the property file I will have to save it with UTF-8 encoding. Since struts heavily uses the Property files for internationalization, will it be possible for me to use the files with Unicode text in them.

I request your advice on how to use the Property file in such a case (or should I use the normal tab-separated text option as above, with the file,being read using Java I/O API).

Thanks,
Debashish Chakrabarty
http://www.jroller.com/page/debashish









--
Jason Lea




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to