I was working with an app that loads a .properties
file with java.util.Properties
like this:
Properties _properties = new Propertie
Java does not handle the BOM correctly – you can see it in the properties as key. It is possible to save the file UTF-8 but without BOM. In vim for instance
:set nobomb
See vim wiki
Thanks to @KonstantinV.Salikhov and @pms for their help in hunting this down; I decided to post the answer that was discovered to save people hunting through the comments.
The problem was that my file was the wrong encoding, as mentioned here: http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html
The load(Reader) / store(Writer, String) methods load and store properties from and to a character based stream in a simple line-oriented format specified below. The load(InputStream) / store(OutputStream, String) methods work the same way as the load(Reader)/store(Writer, String) pair, except the input/output stream is encoded in ISO 8859-1 character encoding.
(Emphasis mine).
I changed the encoding of the properties file to ISO-8859-1 and everything worked.