UTF-8 i18n Struts

As promised, here’s how you correctly get Struts and Tomcat to display UTF-8 characters correctly for i18n. It’s not that complicated, really, but it took quite a while to find out how:

You have to convert your UTF-8 properties-file with a program called natice2ascii. It comes with the SDK/JDK and is located in the bin folder of you Java-installation. This program converts the UTF-8 file to an ASCII file where the UTF-8 characters are written as Unicode Hex. The conversion is done like this:

native2ascii -encoding utf-8 c:\1.txt c:\2.txt

That’s about it, the file can now be used by Struts. Source: Support Eastern Languages in Your Struts Web Applications.

Join me later when I will write about something less nerdish.


Feedback

Do you have any thoughts you want to share? A question, maybe? Or is something in this post just plainly wrong? Then please send an e-mail to vegard at vegard dot net with your input. You can also use any of the other points of contact listed on the About page.

Caution

It looks like you're using Google's Chrome browser, which records everything you do on the internet. Personally identifiable and sensitive information about you is then sold to the highest bidder, making you a part of surveillance capitalism.

The Contra Chrome comic explains why this is bad, and why you should use another browser.