in reply to Re^2: directories and charsets
in thread directories and charsets
I agree that the problem is your subdirectory names coming in bytes. You need to know their charset, then call Encode::decode to map them from the appropriate charset (probably utf8 or UCS-2) into perl characters.
If you hex dump the bytes and take a look on http://www.fileformat.info/info/unicode/ you should be able to work out what encoding you're getting back from readdir on the different platforms. Then do:
Your scalars in @files will then be kosher perl unicode strings, and when they are concatenated with the unicode strings you are getting from your parameter file all should be well.my $encoding = "xxx"; # Probably 'UTF-8' or 'UTF-16LE' for windows my @files = map { Encode::decode($encoding, $_) } readdir DIR;
Good luck.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: directories and charsets
by soliplaya (Beadle) on Mar 15, 2007 at 21:18 UTC |