Add new comment

Java: Loading Resource Bundle File with UTF-8

Submitted by kai on Sat, 2008-03-08 23:47. ::

You hear that UTF-8 is the gold standard in internationalization. so you prepare your JSP pages to use UTF-8 charset.

Then you get your resource bundle files(property files) to use UTF-8 encoding. Everything looks fine in your text editor.

Now you load up the pages. Every character retrieved from your resource bundles look garbled.

This is because Java loads property files using ISO 8859-1 character encoding. Resource bundle utf-8 hack comes to rescue.

Note that in JDK 1.6, you can use PropertyResourceBundle constructor to take a Reader which uses UTF-8 encoding.

Reply



The content of this field is kept private and will not be shown publicly.


*

  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • WikiText is converted to HTML (supported WikiText formatting will show in the long tip format).
Verify comment authorship
Captcha Image: you will need to recognize the text in it.
*
Please type in the letters/numbers that are shown in the image above.