New Approach to Encoding in IntelliJ IDEA - Continued
In one of the recent posts we have discussed the new way to deal with encoding of the source files. Today, we’ll continue with the properties files. As of EAP of IntelliJ IDEA 8.0, encoding of the properties files also becomes a project setting, rather than global, as it used to be in the earlier versions.
If your project contains textual strings that should be exposed to the end user and require localization, it is a good idea to store them in the dedicated properties files. IntelliJ IDEA recognizes such files, denotes them with the special icon, and supports syntax of the key-value pairs. Moreover, if there are numerous properties files for the different languages, with the same base name, IntelliJ IDEA automatically joins them into a resource bundle, and provides a special editor.
The way IntelliJ IDEA perceives properties files strongly depends on the file encoding, which applies to the properties files in the current project.
It is advisable to use ISO-8859-1 encoding for the properties files, unless you have some special reasons to choose another one. If you reuse properties files that come in some different encoding, you can specify the default encoding on the project level:
National characters require special care. You have two possible options: escape each character with the backslash, or convert automatically. With the natural desire to avoid headache, select the check box Transparent native-to-ascii conversion in the File/Directory Options dialog, and instead of the horrifying \u0412\u0430\u0448\u0430 \u0444\u0430\u043c\u0438\u043b\u0438\u044f, you can enter and view nice and tidy characters, though they are still stored as escape sequences: