DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone >

New Approach to Encoding in IntelliJ IDEA - Continued

Irina Megorskaya user avatar by
Irina Megorskaya
·
May. 21, 08 · · Interview
Like (0)
Save
Tweet
11.57K Views

Join the DZone community and get the full member experience.

Join For Free

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.

[img_assist|nid=3058|title=|desc=|link=none|align=left|width=539|height=218]

 

 

 

 

 

 

 

 

 

 

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:

[img_assist|nid=3059|title=|desc=|link=none|align=left|width=368|height=408]

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

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:

[img_assist|nid=3060|title=|desc=|link=none|align=left|width=184|height=86]

 

 

 

 

Enjoy!

intellij

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • What Is HttpSession in Servlets?
  • The Most Popular Kubernetes Alternatives and Competitors
  • What Are Cookies in Servlets?
  • Comprehensive Guide to Jenkins Declarative Pipeline [With Examples]

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo