Encoding problems with properties files and IntelliJ

by Erik van OostenNovember 4, 2010

The Java platform has fantastic support for many character encodings. So it is a bit odd when you find out that regular properties files, read through the Properties class only supports the ISO-8859-1 encoding.

Contrast this with the increasing custom to use UTF-8 as default encoding for all files in a project (as configured through the pom.xml).

IntelliJ automatically picks up the pom setting. However, it also applies this to properties files. This gives some serious problems when you start to edit i.e. Wicket message texts.

Luckily you can change this setting in IntelliJ: File -> Settings, enter “encoding” in the top-left, select “File Encodings” and then set “Default encoding for properties files” to “ISO-8859-1”. Feel free to play around with the “Transparent native-to-ascii conversion” as well.

Update 2010-11-14: Wicket 1.5 bonus: rename your properties file to *.utf8.properties, and Wicket will read it with UTF8 encoding!