Tassos Bassoukos

Environmentaly friendly. Using 100% recycled electrons.

Character set that understands property files

If you are a Java developer in a non-ISO8859-1 environment, you will have encountered the character set problem when editing property files. The spec says that they are in ISO8859-1, with Unicode escape sequences for characters outside that set. While one can set up automatic translation, it is intrusive and not suited to all cases. Being fed up with the problem and the inelegance of all the available solutions, I wrote a custom character set provider which handles the property file encoding as a multi-byte character set.

The source is here, and the prebuilt JAR is here. To use the property character set, drop the JAR file in the extension folder of your JRE, usually $JAVA_HOME/lib/ext and restart (or start) your application. Property files should be assigned the "X-PROP" character set, and all should be ready.

If you are using Eclipse 3.1 or later, simply go to Window → Preferences → General → Content Types → Text → Java Properties files, set the default encoding to X-PROP and select Update to apply the setting.

The code is in the public domain, and I'm not responsible if it munges your files, destroys your computer or causes the next ice age, etc...

@ Monday, 12 December 2005, 23:58 in (Eclipse, Software) - comment ?

Not the most prolific writer ever >> << Infosystem 2005

Post a comment
Name:
Webpage:
Save this info.
Comment Text:
Trackback

The Trackback link for this post is here.