• Post Reply Bookmark Topic Watch Topic
  • New Topic

Unicode and Property files  RSS feed

 
Yash Sharma
Ranch Hand
Posts: 61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have an application that does not use a database and would read the Language equivalent value for English keys from Property file. Can Uncicode text (say Unicode text for various Indian languages) be stored in a Property file?
What I am worried about is that Property files perhaps cannot be saved with any encoding (while a normal text file can be saved with, say UTF8 encoding)so if I save Uncicode text in Hindi in a property file will it remain intact?
Thanks for your time.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The API for Properties describes how this works. All Unicode chars can be saved; however if you look at the raw file data you will see that if the chars are outside the ISO-8859-1 range, they are represented using Unicode escape sequences, such as "\u03a9". Which is a little ugly to look at, but you don't have to look at the files yourself. Just use the store() and load() methods; Java will take care of everything for you, and all your Unicode characters will be properly saved and retrieved.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!