Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 30164

Summary: [resources] Resources names in file system are not i18n (file.encoding problem)
Product: [Eclipse Project] Platform Reporter: mobilae <studnev>
Component: ResourcesAssignee: DJ Houghton <dj.houghton>
Status: RESOLVED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: eclipse, zvonov
Version: 2.0.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Attachments:
Description Flags
Workspace, file system and project properties none

Description mobilae CLA 2003-01-24 06:54:48 EST
If i setup Baltik languages and Latvian locale,
then files and folders in OS appears to be wrongly named.

For example, if i create a project named in latvian with special
letters (you can enter them by right Alt and a letter on keyboard),
then they are displayed correctly in eclipse view,
but not in OS file system. This is not a problem of OS, as soon
as i can enter files and folders names in OS directly.

Moreover, file properties displays file path correctly.

This was revealed when trying to export/import this project, as soon
as it failed to export by Browse button.
But if i enter path manually (with correct project name) then it is imported.

Look attach picture

Note: i have 4 languages active in my OS: latvian, bulgarian, english, russian.
Comment 1 mobilae CLA 2003-01-24 06:56:12 EST
Created attachment 3121 [details]
Workspace, file system and project properties
Comment 2 mobilae CLA 2003-01-24 09:53:32 EST
Additional investigation showed that it happens
when default language does not correspond computer locale.
Defaulkt language effects in file.encoding JVM property.
If you try create resources NOT in file.encoding codepage
Eclipse convert characters and that is bad.

Seems like Eclipse creates file names not in UTF8?
Comment 3 Denis Zvonov CLA 2003-01-24 10:07:58 EST
More precisely:
When some strings collected by eclipse is going to be filenames, they are 
transformed into byte arrays with String.getBytes() or so. This getBytes() uses 
default encoding, set in file.encoding property. This property is set by JVM on 
startup to current windows locale. It is usually non-UNICODE encoding (such as 
Cp1251).
Eclipse should depending on underlying OS use UNICODE-encoding where possible 
(UTF-8, UTF-16, USC-2...) (I dont quite remember which one is to be used in 
Windows 2000/XP). So you need to use getBytes("UTF-16") or so everywhere in 
output to filesystem.
Comment 4 Rafael Chaves CLA 2003-02-05 13:51:55 EST
Could you please inform which Eclipse build and JRE provider/version you are 
using?

Some VMs do not handle file names containing characters not supported in the 
default encoding properly on Windows 2K/XP. Eclipse uses the core Java APIs and 
native calls for creating file/folders and listing directory contents. 1.4 
level VMs seem to support files containing any Unicode characters properly (if 
the OS provides support).

However, before build 20030205, Eclipse didn't handle those files properly even 
when running on 1.4 level VMs (see bug 13163).

Could you try this build with a 1.4-level VM to see if the problem persists? 
Thanks.
Comment 5 Denis Zvonov CLA 2003-02-06 02:05:12 EST
We are using Sun java 1.3.1_06.
Sorry but we NEED it to work on 1.3.1 (as soon as eclipse declares 1.3 support 
and we rely on this declaration in our work). And this problem certanly can be 
fixed by eclipse developers. Look my previous comment and just fix one string 
in your java code.
Comment 6 Denis Zvonov CLA 2003-02-06 02:07:38 EST
Forget to give you eclipse build: we are using eclipse 2.0.1 release (build 
200208291828)
Comment 7 Rafael Chaves CLA 2003-02-06 11:40:32 EST
Denis, we don't do any encoding when creating files and folders, we just call 
the standard Java I/O API passing Java strings (which are Unicode). So, 
although Eclipse supports 1.3 level JREs, we cannot overcome all bugs in the 
underlying JRE that avoid Eclipse of working properly.

The good news is that this bug seems to be fixed in the new Sun JRE 1.3.1_07.

From JavaSoft's bug parade:

java.io: Cannot create files with full Unicode names (Win32/NT) 
http://developer.java.sun.com/developer/bugParade/bugs/4185525.html

Please let us know if the problem goes away using the new VM. 
Comment 8 Rafael Chaves CLA 2003-02-06 14:25:33 EST
I could verify that Sun JDK/JRE 1.3.1_07 seems to effectively fix the problem. 
By the way, the bug I intended to refer to before (see comment 4) was actually 
bug 13463 (whose fix now works also on this new JRE).

DJ, I suggest this bug to be closed as works-for-me.
Comment 9 DJ Houghton CLA 2003-02-07 15:48:09 EST
Closing.