[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.jdt] [BUG??] How to display Unicode character in "Console"?

Hi, I have tried it for a long time. and tried search on bugzilla but I don't see any report on it.

I wanted to show both Trad. And Simp. Chinese in Eclipse debugging console at the same time.

I remember it was success, but fail again??
add -Dfile.encoding=UTF8 into -vmargs in eclipse shortcut,
add -Dfile.encoding=UTF8 to the Run job

It fail on
System.out.println(CHINESE);   //CHINESE is a constant of String contains both  Trad. And Simp. Chinese 
but success on
System.out.write(CHINESE.getBytes("UTF-8");
while
Charset.forName(System.getProperty("file.encoding")) is UTF-8

----
envirement
Windows XP professional
Run Eclipse by Sun JRE 1.5
Eclipse 3.0.2
default file.encoding=MS950_HKSCS
(MS950_HKSCS only contains Trad. Chinese, and did not contains Simp. Chinese)

-------
Test Case 1
a. none Eclipse startup argument
b. none parapeter of run task
>> Trad. Chinese can display by println, but Simp. Chinese become "?" 

Test Case 2
a. none Eclipse startup argument
b. "Run" vm arguments add -Dfile.encoding=UTF8
>> Trad. Chinese can display by println, but Simp. Chinese become "?" 

Test Case 3
a. Eclipse startup with -Dfile.encoding=UTF8
b. none parapeter of run task
>> All character broken by println
>> GOOD result by out.write(CHINESE.getBytes("UTF-8"))

Test Case 4
a. Eclipse startup with -Dfile.encoding=UTF8
b. "Run" vm arguments add -Dfile.encoding=UTF8
>> All character broken by println
>> GOOD result by out.write(CHINESE.getBytes("UTF-8"))
++ Why? I thought System.out did using file.encoding as default charset

Then, when I writing this message, I found that using different "JRE" in run/debug/junit may also cause different result.
I have tried JRE1.5/1.4, and with/witout -Dfile.encoding in defaeult vm arguemnts.
(Test Case 1~4 are running by JRE1.4 while Eclipse running on JRE1.5)

Test Case 5
a. Eclipse startup with -Dfile.encoding=UTF8
b. "Run" have no vm arguments
c. use JRE1.5 as JRE with vm arguments "-server -ea -Dfile.encoding=UTF8"
>> GOOD result by println
>> GOOD result by out.write(CHINESE.getBytes("UTF-8"))
   ( I think this is the case I did success before)

Test Case 6
a. Eclipse startup with -Dfile.encoding=UTF8
b. "Run" have no vm arguments
c. use JRE1.5 as JRE with vm arguments "-server -ea"
>> All character broken by println
>> GOOD result by out.write(CHINESE.getBytes("UTF-8"))

Test Case 7
a. Eclipse startup with -Dfile.encoding=UTF8
b. "Run" have vm arguments "-Dfile.encoding=UTF8"
c. use JRE1.5 as JRE with vm arguments "-server -ea"
>> GOOD result by println
>> GOOD result by out.write(CHINESE.getBytes("UTF-8"))


--------
I think Eclipse should have a feature that changing charset using in the "Debug" window.


thanks for you notices.