Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ansi vs utf8 characters in filename  RSS feed

 
Gerardo Segura
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I just don't know where to look for an answer on this: I'm developing a program which generates a file, whose name is extracted from another file, which holds a list of names. For instance, suppose the word voilá is extracted from the source file, then the new file name is: voilá.txt

The thing is, if I run the program from inside my IDE (netbeans) the source file content MUST be utf-8 encoded, otherwise the file name has some weird characters. No biggy I thought, but then when I run the same program from the command prompt, the opposite must be done: The source file MUST be ANSI-encoded in order the correct characters are rendered in the file name.

So, why is this happening? I know how to specify encoding for content, but how to do it in the file name??
But most important question is: how 'the environment' determines the encoding?

Here is how I'm creating the file :


any help is much appreciated
regards
 
Gerardo Segura
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Found it, it's a system property

java.exe -Dfile.encoding=UTF-8 ....

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!