Community
Participate
Working Groups
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.
Created attachment 3053 [details] var2.jpg (Screen Cut of the step 5)
Moving to JDT UI for comment.
Philippe, don't know if this is Java Text or Core. But since the compiler generates a compile error....
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 ?
Created attachment 3073 [details] A source file containing 2 GB18030 character The variable name contains a GB18030 char between 'a' and 'b'
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.
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,
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?
Created attachment 3078 [details] Preferences to set the encoding This is where you should set the encoding to GB18030.
Change milestone.
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).
My encoding is the default value -- GB18030. But the bug does exists with J2RE 1.3.1 IBM Windows 32 build cn140-20020902
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?
Closing as WORKSFORME, since the VM used can lead to the problem.