[Israel.pm] Perl and Unicode file names

Shlomi Fish shlomif at iglu.org.il
Thu Feb 24 04:27:03 PST 2005


On Thursday 24 February 2005 13:11, Peter Gordon wrote:
> Hi Guys.
>
> I need some help with a project that I have. I have to copy files using
> Perl to different places and the filenames may be in Hebrew, Chinese,
> Korean etc.
>
> The problem is, that filenames, when using opendir, are returned as
> question marks. In the DOS box I have set the codepage to 862. So DIR
> returns accented characters, but Perl still returns question marks. I
> have also set "use utf8", but that didn't help either.
>

Works for me. The following program:

<<<
opendir D, "/dosd/Music/mp3/"; 
my @files = readdir(D); 
closedir(D); 
open O, ">dump.txt"; 
print O (map { "$_\n" } @files); 
close(O);
>>>

Prints the Hebrew filenames with their accents. My locale is en_US/en_AU. 
(non-Unicode). I'm using perl-5.8.5 on Mandrake Linux 10.1.

It would be more helpful if you said what Perl version and operating system 
you're using and what is your locale.

Regards,

	Shlomi Fish

---------------------------------------------------------------------
Shlomi Fish      shlomif at iglu.org.il
Homepage:        http://www.shlomifish.org/

Knuth is not God! It took him two days to build the Roman Empire.



More information about the Perl mailing list