Author
Creating File Name containg french characters using java.io.file
Sudhakar Duraiswamy
Ranch Hand
Joined: Dec 20, 2007
Posts: 43
Creating File Name containg french characters using java.io.file
When i try create a file containg french characters in UNIX environment they appear as ???
Is there a way to specify which Encoding to be used while creating the File ?
Sudhakar
SCJP 5.0 93% | SCWCD (prep. ongoing))
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35224
posted Oct 09, 2009 04:52:08
0
That depends on the editor/application you're using to create the file. Check its preferences. If the file is not pure ASCII, then you'll need the "-encoding" switch to tell javac which encoding it's in.
Android apps – ImageJ plugins – Java web charts
Sudhakar Duraiswamy
Ranch Hand
Joined: Dec 20, 2007
Posts: 43
Guess what i even tried that when i try to compile the class in UNIX i get the below warnings
javac -encoding utf8 test.java
But when i compile it with ISO-8859-1 i dont get the warnings but still the issue persists .
Output:
File getting created as a result of the code in Unix is
852222_???_???_20090915.txt
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35224
posted Oct 09, 2009 08:20:13
0
What is the actual encoding of the file?
Sudhakar Duraiswamy
Ranch Hand
Joined: Dec 20, 2007
Posts: 43
I suppose you refer to the Java File ,If thats the it is 'Cp1252'
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16482
Can I clarify something? We're talking about the name of the file, not the contents of the file, correct?
Sudhakar Duraiswamy
Ranch Hand
Joined: Dec 20, 2007
Posts: 43
yes indeed
subject: Creating File Name containg french characters using java.io.file