Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 232463 - I18N wrong management of escape characters
I18N wrong management of escape characters
Status: NEW
Product: utilities
Classification: Unclassified
Component: Properties
PC Windows 7 x64
: P4 (vote)
Assigned To: Jan Peska
Depends on:
  Show dependency treegraph
Reported: 2013-07-09 16:46 UTC by -Silver-
Modified: 2013-07-09 16:46 UTC (History)
0 users

See Also:
Issue Type: DEFECT


Note You need to log in before you can comment on or make changes to this bug.
Description -Silver- 2013-07-09 16:46:44 UTC

Suppose to have this simple java application:

public static void main(String[] args) {
    System.out.println("This is a string with \"escape\" characters \n");

If it runs the output is correctly:
This is a string with "escape" characters 

Now if I go to Tools -> Internationalization -> Internationalization Wizard.
In the wizard I click always next with all the default parameters (just I create a new resource bundle when it is required).

The resulting application became as follows:

public static void main(String[] args) {
    System.out.println(java.util.ResourceBundle.getBundle("test/bundle").getString("THIS IS A STRING WITH \"ESCAPE\" CHARACTERS \N"));

1) The key generated by default contains also the escape character, this is a problem for example with the character \n that to upper case became \N that is not a valid escape character. (I suggest to avoid to put escape characters in the keys).
2) The value string generated in the contains the escape of the escape character (so \ becames \\) so the output of the application became 

This is a string with \"escape\" characters \n

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo