[Israel.pm] Perl and Unicode file names

Shlomi Fish shlomif at iglu.org.il
Sat Feb 26 00:37:32 PST 2005


On Thursday 24 February 2005 15:03, Peter Gordon wrote:
> Hi Shlomi,
>
> I tried the same thing on XP but it still fails with question marks.
>

Well, I tried it on XP (SP 2) with ActivePerl 5.8.6. I've used encoding 
windows-1255 and the Perl script got the Hebrew characters perfectly. So, I 
don't know what your problem is.

OTOH, the filenames I used are 8-bit and not unicode.

Regards,

	Shlomi Fish

> Regards
>
> Peter
>
> On Thu, 2005-02-24 at 14:27 +0200, Shlomi Fish wrote:
> > 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.
> > _______________________________________________
> > Perl mailing list
> > Perl at perl.org.il
> > http://perl.org.il/mailman/listinfo/perl

-- 

---------------------------------------------------------------------
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