{ by david linsin }

July 17, 2007

Resource encoding in Java

John O'Conner reported that he ran into a common problem concerning encoding of external resources in Java, while playing around with Java FX. He tried to display Japanese characters, by adding them to an FX script and saving it with NetBeans, which didn't work. What happened was that NetBeans saved the script in his native platform encoding, which doesn't work for Java.

Java needs to have it's external resources, like i18n property bundles (ResourceBundle) or as John found out Java FX scripts, to be either plain ASCII or Unicode escaped characters (\uXXXX ).

John mentioned it would be cool if NetBeans had a plug-in. I don't know about NetBeans, but I found a plug-in for Eclipse. It's not up-to-date though, so I guess it won't work with 3.3 yet, but it looks quite cool. I'm definitely gonna check it out, since I think it's a big hassle to run your resource bundles through sun's native2ascii tool every time you changed something.

I totally agree with John on that "we should be past this encoding problem at this point."



  • mail(dlinsin@gmail.com)
  • jabber(dlinsin@gmail.com)
  • skype(dlinsin)