Archive for January, 2011
It’s not often I get confronted by the character encoding problem. I stay away from the web tier. However, this time I needed to refresh myself on EJB 3 and wanted to write a simple web application. Alas in Swedish
Being agile I decided that there will be no i18n, as this application will be used by me and me only. Hence I wrote all JSPs in Swedish (which is btw a valid i18n strategy if you keep multiple copies of the content). To get to the point. Even though IntelliJ IDEA, my editor of choice, clearly displays the file encoding and lets you change it, I couldn’t get it right.
I added stuff like <?xml version=”1.0″ encoding=”UTF-8“?>and <meta http-equiv=”Content-Type” content=”text/html;charset=utf-8“>, but the browsers didn’t believe me.
Notepad++ to the rescue! This program actually has a dedicated menu called “Encoding” where you can change encoding and resave the file with another encoding. I haven’t checked out any other features, but this program is a gift from God based on its handling of file encodings.