It's not a secret anymore!
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
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply 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: 35224
    
    7
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 appsImageJ pluginsJava 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
    
    7
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
    
    2

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
 
I agree. Here's the link: http://zeroturnaround.com/jrebel/download
 
subject: Creating File Name containg french characters using java.io.file
 
Similar Threads
FileNotFoundException error
GUI PhoneBook Reading from disk
Open a .txt file that already exists and add data
Help creating a .txt file using an applet
add timestamp with .txt file & write some information to the .txt file