Bug 70193 - DBCS - GB18030 characters cannot be correctly generated into .classpath file when new a source folder named with GB18030 character
Summary: DBCS - GB18030 characters cannot be correctly generated into .classpath file ...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0.1   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-07-16 02:37 EDT by Ivy CLA
Modified: 2004-09-06 10:31 EDT (History)
1 user (show)

See Also:


Attachments
Modified source file with diff (43.25 KB, application/x-zip-compressed)
2004-07-16 02:39 EDT, Ivy CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivy CLA 2004-07-16 02:37:34 EDT
Reporter: Gao Yin Yin
Language: Simplfied Chinese
Build driver: eclipse-sourceBuild-srcIncluded-3.0M9
JDK Version:  IBM J2SDK 1.4.1
Severity: 1
Summary: DBCS – The GB18030 character cannot be correctly generated 
into “.classpath” file when new a source folder named with GB18030 character.
Steps to recreate problem:
1.	Start up "New Source Folder" wizard;
2.	Set the new folder's name contain GB18030 character, for 
example “newfolder\u3400”;
3.	Click "Finish", new folder infor cannot be generated 
into '${PROJECT_BASE}/.classpath' file as  "<classpathentry kind="..." 
path="..."/>" correctly. The GB18030 character is encoded in error;
4.	Delete this source folder from the 
project, '${PROJECT_BASE}/.classpath' can't be updated correspondingly.

<<Error>>
The GB18030 character cannot be correctly generated into “.classpath” file when 
new a source folder named with GB18030 character.

<<Expected Result>>
The GB18030 character can be correctly generated into “.classpath” file when 
new a source folder named with GB18030 character.
	
<<Cause>>
Eclipse maintains “.classpath” file for each project using UTF8 encoding. When 
new a source folder, Eclipse insert a new "<classpathentry>" element into 
the “.classpath” file using system's default encoding. So error occurs when the 
system's default encoing is not UTF8.

<<Solution>>
Modify “getSharedProperty” and “setSharedProperty” methods in JavaProject.java. 
Keep the encoding being UTF8 during reading and writing “.classpath” file.
Comment 1 Ivy CLA 2004-07-16 02:39:01 EDT
Created attachment 13348 [details]
Modified source file with diff
Comment 2 Philipe Mulet CLA 2004-07-16 10:10:56 EDT
May consider for 3.0.1, will mark it as such for now.
Comment 3 Jerome Lanneluc CLA 2004-08-18 10:37:21 EDT
Assuming that on a chinese platform the correct encoding is set for the 
workspace, shouldn't the workspace encoding be used instead of hardcoding "UTF-
8" ?
Comment 4 Ivy CLA 2004-08-19 21:56:39 EDT
In my chinese platform, the encoding of the workplace is set 
as "gb18030". ".classpath" is a XML file and eclipse creates and maintains it 
with "utf8" encoding. When new a source folder, Eclipse insert 
a "<classpathentry>" element into the “.classpath” file using system's default 
encoding, that's "gb18030" in my system. So error occurs. 
Comment 5 Jerome Lanneluc CLA 2004-08-20 03:58:47 EDT
Thanks. So we would use the .classpath encoding and not the workspace 
encoding. I want to avoid hardcoding "UTF-8".
Comment 6 Jerome Lanneluc CLA 2004-08-24 06:54:28 EDT
Actually hardcoding "UTF-8" is fine as this encoding is always used to encode 
the .classpath.
Comment 7 Jerome Lanneluc CLA 2004-08-24 07:12:16 EDT
Changed JavaProject#getSharedProperty(...) and setSharedProperty(...) (as 
proposed in the attached patch) to use an UTF-8 encoding when reading/writing 
the .classpath.

Added regression test ClasspathTests#testEncoding().

Release to both R3_0_maintenance and HEAD.
Comment 8 David Audel CLA 2004-09-06 10:31:23 EDT
Verified for 3.0.1 RC1