Accents in file name using Java on Solaris

Posted by Stef on Stack Overflow See other posts from Stack Overflow or by Stef
Published on 2009-04-21T15:05:47Z Indexed on 2010/05/24 6:11 UTC
Read the original article Hit count: 372

Filed under:
|
|
|

I have a problem where I can't write files with accents in the file name on Solaris.

Given following code

public static void main(String[] args) {
    System.out.println("Charset = "+ Charset.defaultCharset().toString());
    System.out.println("testéörtkuoë");
    FileWriter fw = null;
    try {
        fw  = new FileWriter("testéörtkuoë");
        fw.write("testéörtkuoëéörtkuoë");
        fw.close();

I get following output

Charset = ISO-8859-1
test??rtkuo?

and I get a file called "test??rtkuo?"

Based on info I found on StackOverflow, I tried to call the Java app by adding "-Dfile.encoding=UTF-8" at startup. This returns following output

Charset = UTF-8
testéörtkuoë

But the filename is still "test??rtkuo?"

Any help is much appreciated.

Stef

© Stack Overflow or respective owner

Related posts about java

Related posts about solaris