My home on the web - featuring my real-life persona!

Fun with character encodings, Greek ANSI

Now that I got the Java encodings half way under control, I encountered “Fun with character encodings” again. This time, it’s a Greek tragedy.

A couple of days ago I received a small text file with English strings. The strings are messages for a service pack and they are needed to be translated in Greek. Unfortunately, that wasn’t all, the text file needs to be in ANSI format because the installer InnoSetup requires that format. Hmm, I immediately thought that smells like trouble because most languages with a different codepage really need to be encoded in Unicode, ANSI does not have enough characters. But first, let’s get it translated.

I got the translation back as a Word file and while I could have probably just asked the translator to send it as a Greek ANSI, I thought I’d give it a shot myself. The first dumb try, open file in Notepad++ and select “Convert to ANSI”. Of course, I get:

greek.INVALID_VERSION_MESSAGE=??t? t? pa??t? e??µ???s?? µp??e? ?a e??µe??se? µ??? t?? ??d?s? %1 ?a? ? d???? sa? e??a? %2.

So I google to see if it is at all possible and yes, it seems like you can encode Greek text in ANSI but unline English, which uses codepage 1252, Greek has to use 1253. Well, that doesn’t seem to be that hard, so I try again. Still the same. OK, maybe a different text editor - nope, doesn’t work either. So, now I send the UTF-8 encoded text file to the Greek translator and ask him if he can convert it into ANSI.

While I wait, I do a little more research and I stumble over a little Microsoft tool named AppLocale. At first I misunderstood the purpose, I thought it is just to switch the system locale, something you can easily do through the control Panel. But after a little more reading, I realized that this may be my solution. I can use AppLocale to open another application and AppLocale will pretend it is a localized Windows environment. So, in my case I needed to look at my Greek ANSI file on a Greek system, which I don’t have. Instead, I use AppLocale to open my text editor and with this instance of the text editor, I open my Greek file. Lo and behold, all characters come out correctly.

greek.INVALID_VERSION_MESSAGE=Αυτό το πακέτο ενημέρωσης μπορεί να ενημερώσει μόνο την έκδοση %1 και η δικιά σας είναι %2.

My file was correct all along, I just couldn’t verify it on my system. I’ll make sure to keep this little application around because I have run into this in the past and usually just ended up submitting a Unicode file and let the developers deal with it. By this time my translator had also sent me the file back and certainly, his looked just the same.

Translator 1, Greek ANSI File 0