Barcelona
Barcelona

Reputation: 2132

Spanish character óé display error in Java properties

When I process a properties file with the Spanish characters ó and é, characters are displayed as ?. I tried different ways to fix this, but still fail:

Nothing worked. What should I do next to fix this issue? Japanese and Russian are still OK.

Upvotes: 2

Views: 3014

Answers (1)

Dubas
Dubas

Reputation: 2876

The properties file needs to be in the proper encoding. By default some IDE's like eclipse saves the content using CP1252 but you are requiring the file as UTF-8. This is also required for your java code.

If you try to use \uxxxx characters but your application by default is working with CP1252 the conversion of the escape code result in a bad character.

If you use the InputStreamReader to force the reading as UTF-8 but your code and/or your file are not using UTF-8 support result in a bad character.

If you use UTF-8 conversion of an string but your source code is CP1252 you should have the same problem.

Related previous answer about source code : Should source code be saved in UTF-8 format

  • Notepad ++ Has a menu to view the format of the file and change it in "Format" menu you should view the file as if it should be opened by other formarts or you should convert the file to other file formats like "UTF-8"

Upvotes: 4

Related Questions