How to not escape unicode symbols in ResourceBundle for UTF-8 files

I use UTF-8 files for messages resource bundle (for Play! 2.2) and I do not need to encode unicode symbols from "Привет" to "\u041F\u0440\u0438\u0432\u0435\u0442". I want to leave it as is for my 'messages.ru' file.

The main question: why I need this encoding if I use UTF-8 files? I do not.
The subsequent problem: Play 2.2 do not understand (or I do not know how to set up it) encoded unicode strings. That's why I do not need unicode symbol encoding.

How to disable it in Idea?
Is there an option not to encode unicode when using UTF-8 properties files?

2 comments

As noted in the Properties class javadoc, the default encoding for properties files is  ISO 8859-1. This is the character set that load() and store() methods use and is therefore the encoding IDEA will default to. To change the encoding, Go to File > Settings > [Project Settings] > File Encodings. On the bottom of the dialog is a pane for stetting Properties Files encoding.  As an alternative, you can leave the file encoded in ISO 8859-1 and turn on the "Transparent native-to-ascii conversion" option. This will let you see and type Unicode characters while the underlying file uses the \u escape values (and thus adhere to the Java standard).

Keep in mind these are per project setting and must be made in each project, or set in your Project Template for future projects,

0

Mark,

I tried to set file encoding as UTF-8, but Idea still encode unicode symbols to \uxxxx.
"Transparent native-to-ascii conversion" setting help a man to read messages, but actually they are still saved as encoded.

I spent a few hours to find any information about this problem and eventually created a feature http://youtrack.jetbrains.com/issue/IDEA-115049

0

Please sign in to leave a comment.