wood burning stoves 2.0*
The moose likes Java in General and the fly likes Creating File Name containg french characters using java.io.file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Creating File Name containg french characters using java.io.file" Watch "Creating File Name containg french characters using java.io.file" New topic
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: 41088
    
  43
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.


Ping & DNS - my free Android networking tools app
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: 41088
    
  43
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: 18541
    
    8

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
 
Similar Threads
Open a .txt file that already exists and add data
GUI PhoneBook Reading from disk
add timestamp with .txt file & write some information to the .txt file
FileNotFoundException error
Help creating a .txt file using an applet