Language environment in perl; how to open a file with filename coded in IBM850

P

phallk

Hi,

any character-set guru out there who can assist me???

I am accessing my Windows-XP-filesystem with samba from my Linux
machine. This works fine as long as there are no Swedish characters in
the filenames but becomes slightly complex (for me at least) when
international characters starts to pop up in the filenames. It seems
like ibm850 encoding is used because doing a "ls" as below works fine:

use encoding "Latin-1";
use open IO => ":encoding(ibm850)"
open (LS,"ls --show-control-chars /mnt/e|") or die $!;
while ($_=<LS>) {
chomp;
print "Fname: /mnt/e/".$_;
}

When reading the directory as above all filenames are displayed
correctly with international characters. But now to my problem:

How do I open a file. Assume the correct filename is stored in $_:

open (FILE,$_);

....will not work as the filename is encoded in UTF8.

This is probably simple, but I have spent quite some time on this.
Thanks in advance.

/Per Hallkvist
 

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,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top