You are here

Determining character encoding of the .locale file

2 posts / 0 new
Last post
jvb
Offline
Last seen: 7 years 8 months ago
Joined: 2008-06-07 19:24
Determining character encoding of the .locale file

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

John T. Haller
John T. Haller's picture
Online
Last seen: 6 min ago
AdminDeveloperModeratorTranslator
Joined: 2005-11-28 22:21
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.

Sometimes, the impossible can become possible, if you're awesome!

Log in or register to post comments