File Names with Accents

Hi. We're having a problem reading file names with accents like umlaut. The files come from a windows zip file and are unzipped to a Solaris 10 server.

Running 'ls -l' shows files with accents displaying properly ( no question marks instead of accents). However in looping through the folder any file with an accent cannot be opened. File.getLength() returns 0 bytes for these files.

So it appears that Solaris stored the file name properly when the files were unzipped, but Java is not able to read the file names if they have accents.

Here is a code snippet:

File folder =new File("/tmp/zipfolder");

File[] files = folder.listFiles();

for (int i = 0; i<files.length; i++){

System.out.println(files[i].getName() +" - " + files[i].length() );

}

Any files with an accent in the file name the accent is replaced with ? and length shows as 0 bytes.

Any suggestions would be appreciated.>

[1165 byte] By [pflickjavaa] at [2007-11-27 11:26:23]
# 1

Appears to be a bug:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6522199

ChuckBinga at 2007-7-29 16:10:07 > top of Java-index,Java Essentials,Java Programming...
# 2

> Appears to be a bug:

> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=652

> 2199

Thanks chuckbing. The original bug

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4899439

lists this workaround which solved my problem:

Set these two environment variables:

LC_ALL=en_US.ISO8859-1

LANG=en_US.ISO8859-1

Thanks again!

pflickjavaa at 2007-7-29 16:10:07 > top of Java-index,Java Essentials,Java Programming...