Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Creating File Name containg french characters using java.io.file

 
Sudhakar Duraiswamy
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?



 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sudhakar Duraiswamy
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the actual encoding of the file?
 
Sudhakar Duraiswamy
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose you refer to the Java File ,If thats the it is 'Cp1252'
 
Paul Clapham
Sheriff
Pie
Posts: 20203
26
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I clarify something? We're talking about the name of the file, not the contents of the file, correct?
 
Sudhakar Duraiswamy
Ranch Hand
Posts: 43
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes indeed
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic