dcsimg
Using resource bundles on a Linux system with accented characters
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Peter_Desaulniers
Posted On:   Tuesday, January 11, 2005 04:09 PM

resource bundles require that the source file either be all ascii characters or u encoded ascii (to support non-ascii characters). They do not allow UTF-8 encoded files. When I attempt to use resource bundles on a French Linux system (may be the same for a US Linux system), accented characters printed from the resource bundle do not display properly. I believe this is the case because when you are instantiating a PropertyResourceBundle it uses the system file encoding when reading the byte off the disk. I think on Linux that encoding is set to UTF-8. Therefore, a non-UTF-8 encoded file is being read in as UTF-8 and that is messing up the characters. I have looked for some way to pass the desired encoding to PropertyResourceBundle but    More>>

resource bundles require that the source file either be all ascii characters or u encoded ascii (to support non-ascii characters). They do not allow UTF-8 encoded files.

When I attempt to use resource bundles on a French Linux system (may be the same for a US Linux system), accented characters printed from the resource bundle do not display properly. I believe this is the case because when you are instantiating a PropertyResourceBundle it uses the system file encoding when reading the byte off the disk. I think on Linux that encoding is set to UTF-8. Therefore, a non-UTF-8 encoded file is being read in as UTF-8 and that is messing up the characters.

I have looked for some way to pass the desired encoding to PropertyResourceBundle but I was unable to find one.

Therefore, there seems to be a mismatch between Java's expectation that encoding will be ISO-8859-1 (or CP1252) when the PropertyResourceBundle is instantiated. This seems to be a global problem for any developer writing java apps that use resource bundles that will run on a Linux platform since its encoding (I think) is UTF-8. This I would think is a very common occurance.

What is the common solution to this problem for java apps using resource bundles running on Linux systems?

   <<Less
About | Sitemap | Contact