Sunday, January 21, 2007

Managing text encoding in Java properties files

Something interesting when you write a software is to translate it. Java has this feature embedded. You simply have to write properties files and use a resource bundle to extract texts in your program. Consult ResourceBundle class javadoc for more information about how to proceed.

Something else very ineresting in about properties file encoding. Java specification supposes this sort of files to be written in ISO-8859-1. Oops! What about translating my software into japaneese? No problem, you cas use "unicode" codes in your files.

For exemple, to translate é, replace it by \u00E9 in your properties file. You can consult for more informations aboiut encodings.

Thus, if you want to retreive characters codes, I propose you think excellent web page (in french) :


Alexandre de Pellegrin said...

To encode a string to write in a properties file, use StringEscapeUtils class from Apache commons-lang library.

Rahul said...

Thanks for the great information in your blog Selenium Training in Chennai