Bug 21195

Summary: text file encoding doesn't support GBK
Product: [Eclipse Project] Platform Reporter: draco <dracodoc>
Component: TextAssignee: Platform-Text-Inbox <platform-text-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: anderson.david, daniel_megert, david_williams, stori
Version: 2.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on: 22016    
Bug Blocks:    

Description draco CLA 2002-07-03 05:15:22 EDT
My system is win2k,locale China,if I set text file encoding to GBK, then the 
java file displays "Character encoding GBK is not supported by this platform".

If I set it to UTF-8, the source window is ok ,but some error message in 
console windows sometimes contains Chinese characters, will not be displayed 
correctly.
Comment 1 draco CLA 2002-07-03 23:25:41 EDT
In another system this problem doesn't occur, but I can't find any difference 
between them. Both system are Win2k, locale Chinese,jdk 1.4.0(system jre 
1.3.1,while Eclipse JRE 1.4.0).
Comment 2 draco CLA 2002-07-04 02:28:49 EDT
the error message in log:
!SESSION Jul 04, 2002 14:18:02.254 ---------------------------------------------
java.version=1.3.1
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=zh_CN
Command-line arguments: -os win32 -ws win32 -arch x86 -data e:\work\workspace -
install file:D:/app/Eclipse/
!ENTRY org.eclipse.jdt.ui 4 1 Jul 04, 2002 14:18:02.254
!MESSAGE Internal Error
!STACK 1
org.eclipse.jdt.core.JavaModelException[985]: 
java.io.UnsupportedEncodingException: GBK
	at sun.io.Converters.getConverterClass(Unknown Source)
	at sun.io.Converters.newConverter(Unknown Source)
	at sun.io.ByteToCharConverter.getConverter(Unknown Source)
	at java.io.InputStreamReader.<init>(Unknown Source)
	at 
org.eclipse.jdt.internal.compiler.util.Util.getInputStreamAsCharArray
(Util.java:242)
	at org.eclipse.jdt.internal.core.Util.getResourceContentsAsCharArray
(Util.java:502)
	at org.eclipse.jdt.internal.core.CompilationUnit.openBuffer
(CompilationUnit.java:757)
	at org.eclipse.jdt.internal.core.Openable.openWhenClosed
(Openable.java:401)
	at org.eclipse.jdt.internal.core.JavaElement.openHierarchy
(JavaElement.java:521)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo
(JavaElement.java:308)
	at org.eclipse.jdt.internal.core.JavaElement.getChildren
(JavaElement.java:264)
	at org.eclipse.jdt.internal.core.JavaElement.getChildrenOfType
(JavaElement.java:273)
	at org.eclipse.jdt.internal.core.CompilationUnit.getTypes
(CompilationUnit.java:567)
	at org.eclipse.jdt.internal.ui.util.OpenTypeHierarchyUtil.getCandidates
(OpenTypeHierarchyUtil.java:234)
	at org.eclipse.jdt.ui.actions.OpenTypeHierarchyAction.getCandidates
(OpenTypeHierarchyAction.java:87)
	at org.eclipse.jdt.ui.actions.OpenTypeHierarchyAction.selectionChanged
(OpenTypeHierarchyAction.java:81)
	at 
org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged
(SelectionDispatchAction.java:187)
	at org.eclipse.jdt.ui.actions.SelectionDispatchAction.selectionChanged
(SelectionDispatchAction.java:182)
	at org.eclipse.jface.viewers.Viewer.fireSelectionChanged
(Viewer.java:147)
	at org.eclipse.jface.viewers.StructuredViewer.updateSelection
(StructuredViewer.java:1155)
	at org.eclipse.jface.viewers.StructuredViewer.handleSelect
(StructuredViewer.java:544)
	at org.eclipse.jface.viewers.StructuredViewer$1.widgetSelected
(StructuredViewer.java:568)
	at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent
(OpenStrategy.java:171)
	at org.eclipse.jface.util.OpenStrategy.access$3(OpenStrategy.java:168)
	at org.eclipse.jface.util.OpenStrategy$1.handleEvent
(OpenStrategy.java:297)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1529)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1291)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1177)
	at org.eclipse.ui.internal.Workbench.run(Workbench.java:1160)
	at org.eclipse.core.internal.boot.InternalBootLoader.run
(InternalBootLoader.java:775)
	at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.eclipse.core.launcher.Main.basicRun(Main.java:248)
	at org.eclipse.core.launcher.Main.run(Main.java:698)
	at org.eclipse.core.launcher.Main.main(Main.java:534)
Comment 3 Dirk Baeumer CLA 2002-07-29 08:54:01 EDT
Nick, can you please comment on that. Is there an additional library needed to 
get GBK encoding ?
Comment 4 Nick Edgar CLA 2002-07-29 14:33:28 EDT
The log indicates that Eclipse is running on jdk 1.3.1.
Perhaps 1.4 has the GBK encoding, but 1.3.1 does not.
Comment 5 Tod Creasey CLA 2002-07-29 15:09:57 EDT
Was GBK avaialble as one of the encoding options from the file encoding menu 
or did you specify it as a run time parameter?

Using a Chinese XP machine with GB18030 installed GBK did not come up as one 
of the options.
Comment 6 Tod Creasey CLA 2002-07-29 15:34:57 EDT
I have just tried this on an XP Chinese machine with GB18030 installed using 
the 1.3.1. VM by typing "GBK" into the text encoding combo box on the 
preference page. This worked just fine.

I think we need more specifics on what machine this is occuring on including

OS
Locale
VM version and vendor
How it was launched
Where GBK is being specified
Comment 7 draco CLA 2002-07-29 22:19:46 EDT
I removed jre1.3.1,reinstalled 1.4.0,now it's OK.
It seemed that if system jre is 1.3.1,Eclipse will use 1.3.1 even I specified 
1.4 in preference.
I specified GBK at preference,workbench,editor,text file encoding,where GBK is 
default.
Comment 8 Tod Creasey CLA 2002-08-06 14:17:11 EDT
GBK has been added for Chinese locales for 2.1. To be released when the fix for 
Bug 22016 is approved.
Comment 9 Dani Megert CLA 2004-05-28 07:05:33 EDT
as stated in comment 7
Comment 10 david CLA 2010-11-30 14:20:53 EST
I have seen this bug when running an app that only had the JRE installed. After we installed the SDK (jdk1.6.0_20), the application ran fine...
Comment 11 Dani Megert CLA 2010-12-01 02:04:53 EST
(In reply to comment #10)
> I have seen this bug when running an app that only had the JRE installed. After
> we installed the SDK (jdk1.6.0_20), the application ran fine...
I don't think it depends on whether you use the JRE or SDK if it's the same version.