2 Replies Last post: Oct 17, 2013 4:23 PM by Andrey Volkov  
Andrey Volkov Newbie 25 posts since
Jun 2, 2009
Currently Being Moderated

Oct 17, 2013 12:46 AM

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?

Mark Vedder Apprentice 1,013 posts since
Dec 10, 2003
Currently Being Moderated
Oct 17, 2013 4:05 PM in response to: Andrey Volkov
Re: How to not escape unicode symbols in ResourceBundle for UTF-8 files

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,

More Like This

  • Retrieving data ...