Bug 29863 - GB18030: Could not create a class variable whose name contains a GB18030 character
Summary: GB18030: Could not create a class variable whose name contains a GB18030 char...
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-21 03:14 EST by Liu Yang CLA
Modified: 2003-01-23 12:56 EST (History)
0 users

See Also:


Attachments
var2.jpg (Screen Cut of the step 5) (79.94 KB, image/pjpeg)
2003-01-21 03:19 EST, Liu Yang CLA
no flags Details
A source file containing 2 GB18030 character (185 bytes, text/plain)
2003-01-22 07:20 EST, Liu Yang CLA
no flags Details
Screen Cut of Eclipse when working with this above file (80.08 KB, image/pjpeg)
2003-01-22 07:38 EST, Liu Yang CLA
no flags Details
Preferences to set the encoding (14.24 KB, image/png)
2003-01-22 08:43 EST, Olivier Thomann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Liu Yang CLA 2003-01-21 03:14:27 EST
OS: Windows2000 Simplified Chinese Version + GB18030 Patch
Eclipse Build: 20020321 Stable Build 

Abstract: Eclipse can't identify that a class variable whose name contains a 
GB18030 Character.

Re-Produce Steps:
1.Start Eclipse
2.Create a basic class
3.Create a class variable whose name contains a GB18030 character
4.Save the class
5.a warning shows up(as is shown in var2.jpg)

Comments:
Before the process, I have changed the Eclipse font to a GB18030 enabled font 
in workbench preference.
I also change the windows display font to GB18030 enabled font.
I can create a class variable which name contains GB2312 character in eclipse.

------- Additional Comment ------- 
Verify with following test environment: 
Eclipse Build: 20021218 Stable Build (bug occured)
JRE version: J2RE 1.3.1 IBM Windows 32 build cn140-20020902 (JIT enabled: jitc)
Result: A variable name COULD NOT contain a GB18030 character.

Eclipse Build: 20021218 Stable Build (bug disappeared)
JRE version: J2RE 1.4.0 IBM Windows 32 build cn140-20020902 (JIT enabled: jitc)
Result: A variable name COULD contain a GB18030 character. And run correctly.
Comment 1 Liu Yang CLA 2003-01-21 03:19:12 EST
Created attachment 3053 [details]
var2.jpg (Screen Cut of the step 5)
Comment 2 Sonia Dimitrov CLA 2003-01-21 09:59:24 EST
Moving to JDT UI for comment.
Comment 3 Dirk Baeumer CLA 2003-01-21 12:14:39 EST
Philippe, don't know if this is Java Text or Core. But since the compiler 
generates a compile error....
Comment 4 Philipe Mulet CLA 2003-01-22 05:57:21 EST
Liu - could you attach some source reproducing this very problem ? Did you also 
position the text encoding correctly (so that our compiler is treating your 
file correctly ?).

One more thing to try, does javac compile it ok ?
Comment 5 Liu Yang CLA 2003-01-22 07:20:25 EST
Created attachment 3073 [details]
A source file containing 2 GB18030 character

The variable name contains a GB18030 char between 'a' and 'b'
Comment 6 Liu Yang CLA 2003-01-22 07:27:37 EST
When I compile the source file given in attach 
http://bugs.eclipse.org/bugs/attachment.cgi?id=3073&action=view

The compiler generate such errors:
---------------------------------------------
HelloWorld_GB18030.java:4: Invalid Character£º\65533
        static String a??b = "18030";
                       ^
HelloWorld_GB18030.java:4: Invalid Character£º\65533
        static String a??b = "18030";
                        ^
HelloWorld_GB18030.java:7: Invalid Character£º\65533
                System.out.println("Hello World[" + a??b + "]");

                                                     ^
HelloWorld_GB18030.java:7: Invalid Character£º\65533
                System.out.println("Hello World[" + a??b + "]");
                                                      ^
4 errors
---------------------------------------------
The compiler I used is Sun JDK, version is:
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

btw: I have translate some error message from Chinese into English.
Comment 7 Liu Yang CLA 2003-01-22 07:38:10 EST
Created attachment 3074 [details]
Screen Cut of Eclipse when working with this above file

In the right bottom of this picture, there is a error message generated by
Eclipse. It is different from above messages generated by sun jdk,
Comment 8 Olivier Thomann CLA 2003-01-22 08:39:10 EST
Hi Liu,

You need to set the encoding to GB18030 when you compile your file. In Eclipse
2.1, go to Window>Preferences>Workbench>Editors>Text file encoding and put GB18030.
After I have done that, it compiles fine.

Same thing for javac, compile the file using this command-line:
javac -encoding GB18030 HelloWorld_GB18030.java and the file will compile
without a glintch.
Here is what I got:
D:\temp>javac -encoding GB18030 HelloWorld_GB18030.java

D:\temp>java HelloWorld_GB18030
Hello World[18030]

So I don't see any problem with your file if the proper encoding are used. If
you don't set the encoding in Eclipse, then the default encoding is selected. If
the default encoding should be GB18030, I guess this is a problem with
Platform/Core or Platform/UI.
Ok to close on the JDT/Core side?
What is the default encoding when you start Eclipse?
Comment 9 Olivier Thomann CLA 2003-01-22 08:43:52 EST
Created attachment 3078 [details]
Preferences to set the encoding

This is where you should set the encoding to GB18030.
Comment 10 Olivier Thomann CLA 2003-01-22 10:05:17 EST
Change milestone.
Comment 11 Olivier Thomann CLA 2003-01-22 12:31:43 EST
Close as INVALID, since the problem seems to be due to the usage of a wrong
encoding. Please reopen if the problem persists after switching to the right
encoding (GB18030).
Comment 12 Liu Yang CLA 2003-01-23 00:17:45 EST
My encoding is the default value -- GB18030. 
But the bug does exists with J2RE 1.3.1 IBM Windows 32 build cn140-20020902 


Comment 13 Olivier Thomann CLA 2003-01-23 08:33:30 EST
Are you sure that the IBM VM you are using is providing the charset conversion? 
You need an internationalized version of the VM. This is a pure VM problem. It 
has nothing to do with Eclipse. The Eclipse encoding support is fine... at 
least with your example. I tested it.
Install a VM that has all encodings support.
If you look at:
http://java.sun.com/j2se/1.3/docs/guide/intl/encoding.doc.html you will see 
that a 1.3 VM doesn't have the GB18030 encodings charset, whereas at this link 
http://java.sun.com/j2se/1.4/docs/guide/intl/encoding.doc.html, you can check 
that a 1.4 VM has this encoding in its charsets.jar file.
Ok to close then?
Comment 14 Olivier Thomann CLA 2003-01-23 12:56:17 EST
Closing as WORKSFORME, since the VM used can lead to the problem.