0

I have a properties file with some properties in Portuguese language, using some accented characters. These properties are read from a 3rd party library (Controls FX Dialogs). But somehow the accented characters are being read in the wrong encoding (tested only on MS Windows).

This is what i have in my properties file:

dlg.yes.button = Sim
dlg.no.button = Não

And this is how it looks on the running app: enter image description here

All my project files (including java sources and properties files) are encoding in UTF-8. I can only test it on windows, so i think it has something related to windows default encoding (Cp1252). I also tried to run the app using UTF8 encoding with the option -Dfile.encoding=UTF8, but the problem still persists

Any idea of why this is happening?

Mateus Viccari
  • 7,389
  • 14
  • 65
  • 101
  • Take a look at http://stackoverflow.com/questions/4659929/how-to-use-utf-8-in-resource-properties-with-resourcebundle – keuleJ Jul 01 '15 at 20:34

1 Answers1

1

Property files are always treated as ISO-8859-1 files. From the documentation:

The input stream is in a simple line-oriented format as specified in load(Reader) and is assumed to use the ISO 8859-1 character encoding; that is each byte is one Latin1 character.

You will need to either save your file as ISO Latin-1, or write all non-ASCII characters using \u escapes.

VGR
  • 40,506
  • 4
  • 48
  • 63