Determining character encoding of the .locale file

Submitted by jvb on June 7, 2008 - 7:44pm

How does the PortableApps Menu determine what character encoding was used when the locale file was saved?

Case in point: I'm working with the swedish.locale file and when it's encoded with ISO-8859-1, national characters show up as expected. If it's encoded with UTF-8, the menu system displays garbled text instead of the national characters.

Technically, our national characters are represented as single bytes in ISO-8859-1 and as 2 bytes each in UTF-8.

Suggestion: use a method similar to that of XML, or Python, in which the file carries an annotation about what encoding was used when it was saved.

E.g like this:

[PortableApps.comLocaleDetails]
Encoding=UTF-8
Name=Swedish

or
[PortableApps.comLocaleDetails]
Encoding=iso-8859-1
Name=Swedish

Then the program would always know what characters are in the file.

This may sound like a Catch-22, but the XML spec explains it well:
http://www.w3.org/TR/2004/REC-xml-20040204/#sec-guessing


( categories: )

No Unicode

The menu doesn't accept unicode input at the moment, so it's using the appropriate encoding on each .locale file. So, if you encode it as ISO-8859-1 and you're using it on a Windows machine with the appropriate codepage it shows up just fine. If you use UTF8 it'll be gibberish.

Live with purpose.