How to enforce filename encoding?

G

guava

Hi,

I have a files with file nname encoded with Cp1252. I'm running Linux
redhat 9 with UTF-8 as default system charset. How do I enforce Sun's
VM to read the file with Cp1252 encoding? I tried with file.encoding
system option and that does not quite work. Just wondering if there's
any trick to Sun's VM that I should do? I'm using JDK 1.4.2.

Thanks.
 
G

Gordon Beaton

I have a files with file nname encoded with Cp1252. I'm running
Linux redhat 9 with UTF-8 as default system charset. How do I
enforce Sun's VM to read the file with Cp1252 encoding? I tried with
file.encoding system option and that does not quite work. Just
wondering if there's any trick to Sun's VM that I should do? I'm
using JDK 1.4.2.

If you want to use a particular encoding when you read the file
contents, open the file with a FileInputStream and specify the
encoding when you create the InputStreamReader.

Or did you really mean the filename? I don't think it's meaningful to
talk about specifying an encoding for reading filenames, since you
never can read the raw bytes that were used to write the name anyway.

/gordon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top