2

I'm wondering if anyone has encountered this problem and how he solved it. I worked in a project where the IDE is not imposed to developpers (we can use Eclipse, Netbeans etc.).

When working with properties file (Java wait for an ISO-8859-1 encoding), eclipse handles them well, but in Netbeans, each national char (éàü etc.) are automatically escaped like this \uxxx. So eclipse users will get properties file with escaped characters, which is really annoying.

It is painful for i18n for instance.

Does anyone found a workaround for this ?

Edit

In Netbeans 8, it's possible to check an option for properties file that allow us to use project encoding. (See comments below).

Maxime
  • 570
  • 3
  • 18

1 Answers1

1

That's a sane default behavior - properties file are read using ISO-8859-1 encoding by default (How to use UTF-8 in resource properties with ResourceBundle or find some other resources). I think that NetBeans editor lets you edit them using UTF-8 and converts the content on save. You can override this: select the file (for example in project tab), choose Properties from its context menu and make it use project encoding. NetBeans will not perform the conversion then.

Community
  • 1
  • 1
Radim
  • 4,721
  • 1
  • 22
  • 25
  • Hi, actually, in Netbeans 7.3.1, I'm not able to change encoding per file. Netbeans handles the encoding per project. I guess it detects that the characters I'm typing are in UTF-8 (due to project UTF8 encoding), and especially for properties file, because Java requires iso 8859 1, it escapes them. – Maxime Apr 09 '14 at 08:46
  • I see, it is indeed added later. Since you are two releases behind the current version (8.0) I'd recommend you to upgrade. – Radim Apr 09 '14 at 14:28