This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 98512 - I18n wizard does not work correctly if source code contains escape sequence
Summary: I18n wizard does not work correctly if source code contains escape sequence
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: I18N (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Marian Petras
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-03-21 17:14 UTC by Jana Maleckova
Modified: 2008-03-27 22:37 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jana Maleckova 2007-03-21 17:14:13 UTC
NetBeans IDE Dev (Build 200703201900)
1.6.0; Java HotSpot(TM) Client VM 1.6.0-b105
Windows XP version 5.1 running on x86
en_GB (nb); Cp1252

Description:
============
have jFrame e.g contained jLabel. Text of jLabel has special character
e.g. Degrees [°] - displayed in design, in source code there this text is 
represented as escape sequence - "Degrees [\u00b0]: "

Problem, when user wants this form internationalize through i18n wizard.
Wizard works just with source code and doesn't recognize, "Degrees [\u00b0]: "
represents special character and considers it as string.
It causes that form can't load correct value from bundle.
Another point: wizard should also offer user correct key value - "Degrees [°] "
during replacing - instead of "Degrees [\u00b0]: "
Comment 1 Marian Petras 2007-03-23 14:58:05 UTC
Confirmed, accepted.
Comment 2 Jana Maleckova 2007-04-25 10:21:00 UTC
now in resource bundle there is special character represented as \\uxxxx but
generated code (for key) which load value from properties contains only one
backslash => not possible to run the application.

i18n is done by wizard
Comment 3 Marian Petras 2007-04-25 16:19:12 UTC
This bug manifests only if all of the following conditions are met:
  - automatic internationalization is turned off in the form editor
  - the user runs additonal internationalization of a form element's text
  - the element's text contains at least one non-ASCII character

There is a workaround possible - either use the automatic internalization of a
text in the form editor (in the customizer of the element's "text" property,
select item "Resource Bundle" from the combo-box) or enter the element's text as
a custom code (in the customizer, select item "Custom Code") and then
internationalize using the Internationalize... action.

It is not a regression - it is present both in NB 5.5 and NB 5.5.1 (latest build).

The bug is not so easy to fix (so I removed the SIMPLEFIX keyword) and it is
quite risky to attempt to fix it that late in the development cycle for M9.
Comment 4 Jana Maleckova 2007-05-18 09:42:18 UTC
note for me: after fix, verify it together with issue 101732
Comment 5 Marian Petras 2007-07-20 17:52:41 UTC
Fixed in the trunk.

The I18n wizard now recognizes both Unicode escape sequences and octal escape sequences and handles them as equivalent
characters.

Modified files:
    i18n/src/org/netbeans/modules/i18n/java/JavaI18nSupport.java   (1.20)
    properties/src/org/netbeans/modules/properties/Element.java   (1.37)
    properties/src/org/netbeans/modules/properties/UtilConvert.java   (1.18)
Added test classes:
    i18n/test/unit/src/org/netbeans/modules/i18n/java/JavaI18nSupportTest.java   (1.1 - new file)
    properties/test/unit/src/org/netbeans/modules/properties/ElementTest.java   (1.1 - new file)

Diffs:
http://i18n.netbeans.org/source/browse/i18n/src/org/netbeans/modules/i18n/java/JavaI18nSupport.java?r1=1.19&r2=1.20&diff_format=u
http://properties.netbeans.org/source/browse/properties/src/org/netbeans/modules/properties/Element.java?r1=1.36&r2=1.37&diff_format=u
http://properties.netbeans.org/source/browse/properties/src/org/netbeans/modules/properties/UtilConvert.java?r1=1.17&r2=1.18&diff_format=u
http://i18n.netbeans.org/source/browse/i18n/test/unit/src/org/netbeans/modules/i18n/java/JavaI18nSupportTest.java?rev=1.1&content-type=text/vnd.viewcvs-markup
http://properties.netbeans.org/source/browse/properties/test/unit/src/org/netbeans/modules/properties/ElementTest.java?rev=1.1&content-type=text/vnd.viewcvs-markup
Comment 6 Jana Maleckova 2007-10-12 10:44:30 UTC
Product Version: NetBeans IDE Dev (Build 20071012030351)
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b05
System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb)

Description:
============
now i18n wizard drop all strings which contains escape sequences and doesn't offer them like strings which should be
replaced. Therefore I have to reopen this issue
Comment 7 Marian Petras 2007-10-12 13:57:33 UTC
This bug is really fixed, with the exception of strings in guarded blocks, as reported in bug #114874.

While trying to reproduce this bug, I found that if I put a non-internationalized string (with a Unicode sequence)
outside of the guarded block and run the Internationalization wizard, the wizard correctly translates (almost) all
non-internationalized strings, even those in the guarded block.
Comment 8 Jana Maleckova 2007-10-22 13:17:26 UTC
verified on

Product Version: NetBeans IDE 6.0 Beta 2 (Build 200710212201)
Java: 1.6.0_02; Java HotSpot(TM) Client VM 1.6.0_02-b05
System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb)