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.

Similar entries

2 Responses to “UTF-8 i18n Struts.”

  1. Kristoffer Says:
    March 12th, 2006 at 03:58:34

    Thanks a bunch, mate! It’s probably the best birthday present EVER!!! Almost. (since it wasnt quite my birthday when you sent it, but I was havin my party when I read it!!!)

    Unicode Hex: How to party without it..?

  2. Vegard Says:
    March 12th, 2006 at 10:04:39

    What? You had a party, and we were not invited? No more Unicode Hex for you!

Leave a Reply




About

Vegard SkjefstadYou're visiting the blog and personal web site of Vegard Skjefstad.

Entry Calendar

September 2010
M T W T F S S
« Aug    
 12345
6789101112
13141516171819
20212223242526
27282930  

From Twitter

Ah, Space Music in the morning. http://www.di.fm/ 1 day ago (follow me)

New Comments

vegard on "How To Build a Silent Mini-ITX server."
Finn Nielsen on "How To Build a Silent Mini-ITX server."
Kristoffer on "Depth."
Tom on "100 things"
vegard on "Depth."