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 125875

Summary: I18N - wrong encoding in language file
Product: groovy Reporter: deamon <deamon>
Component: EditorAssignee: schmidtm <schmidtm>
Status: RESOLVED DUPLICATE    
Severity: blocker CC: kfrank
Priority: P3 Keywords: I18N
Version: 6.x   
Hardware: All   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: incorrect encoding

Description deamon 2008-01-23 22:27:25 UTC
I've created a Grails project and opened the german message bundle. NetBeans doesn't show german umlauts (some german
characters like รค (&auml;)) corretly. I opened the same file in the good old jEdit and verified that it is UTF-8.
Umlauts are shown correctly there. 

This problem doesn't occure in groovy files.

I am missing the information about the current encoding and an easy way to change it. It is not possible to change it in
the project settings like in java projects. The default should be UTF-8 as in Grails.
Comment 1 deamon 2008-01-23 22:29:40 UTC
Created attachment 55454 [details]
incorrect encoding
Comment 2 deamon 2008-01-23 22:35:25 UTC
Tested with NetBeans IDE Dev (Build 20080123145057)
Comment 3 Ken Frank 2008-02-14 20:38:45 UTC
what is the project encoding property of your project ?


nb6 does allow to change the project encoding unless its a netbeans
module project, but is groovy part of the netbeans basic product or is
it from update center ?

if from update  center then it might not have this and other feq
file encoding functionality implemented yet.

ken.frank@sun.com
Comment 4 deamon 2008-02-14 23:13:37 UTC
The Groovy plugin is from the update center and in the project options I can not see the encoding.
Comment 5 Ken Frank 2008-02-14 23:32:54 UTC
thanks for confirming. I think that having the feq encoding handling
code added along with project encoding property could solve this 
for future - for now I think that plugin propably using the encoding
of the locale you are in as the encoding its assuming.

I don't know what the german message bundle is - is it from 
a translated netbeans itself ? nb has not been translated yet
completely for 6.0 however.

the bundles in product translated files have had native2ascii run on them
so that could be another reason why not seeing the characters ok.

ken.frank@sun.com
Comment 6 schmidtm 2008-02-28 10:14:10 UTC
I just took a short look at this issue and found out, that the encoding of the (grails) message bundles use TWO escape
characters like shown here:

typeMismatch.java.net.URL=Die Eigenschaft {0} muss eine g\u00C3\u00BCltige URL sein

But according to the Java documentation found here: http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html

"When saving properties to a stream or loading them from a stream, the ISO 8859-1 character encoding is used. For
characters that cannot be directly represented in this encoding, Unicode escapes  are used; however, only a single 'u'
character is allowed in an escape sequence."

When i insert a new character in the message bundle using NetBeans i get the proper single-escape encoding:

test.name=J\u00F6rn

We have to find out what's specified in Groovy/Grails.
Comment 7 schmidtm 2008-02-28 10:20:46 UTC
Here's what the Grails documentation has to say about encoding of those files.
http://docs.codehaus.org/display/GRAILS/Internationalization

Grails uses Spring and Java I18N mechanisms to supply messages in user-specific languages.

The grails-app/i18n folder contains message bundles (message_xx.properties files) which are Java property files that
combine name/value pairs.

The files must be saved in UTF-8 encoding if you wish to use non-ascii characters, which is contrary to standard Java
properties files which use the native Java VM encoding.

Grails automatically converts your UTF-8 properties files to unicode escaped ascii files prior to execution, removing a
major pain-point for I18N work.

Within your application you can access the message source from the application context, the bean name is
"messageSource", to resolve message codes to text, or within views you can use the <g:message> tag.
Comment 8 schmidtm 2008-02-29 12:49:37 UTC
We are probably facing this issue here:

I18N - Add support for other encodings (other than ISO-8859-1)
http://www.netbeans.org/issues/show_bug.cgi?id=75906

please comment.
Comment 9 schmidtm 2008-03-03 15:29:28 UTC

*** This issue has been marked as a duplicate of 75906 ***