Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^5: how to unicode filenames?

by Corion (Patriarch)
on Jun 28, 2012 at 07:05 UTC ( [id://978845]=note: print w/replies, xml ) Need Help??


in reply to Re^4: how to unicode filenames?
in thread how to unicode filenames?

I'm sorry - I misunderstood your sentence

...and now most linux systems are using UTF-8 as native encoding and perl has no mechanism to deal with this?

as relevant to the problem in the sense that you wanted Perl to automatically decode all filenames from UTF-8. I assumed you wanted an automagic solution becuase certainly you are aware of Encode and the common way of simply decoding all filenames from the filesystem by calling decode('UTF-8', $filename).

If you can post some code where Perl actually munges the filename encoding, that would be interesting, because I am unaware of a situation where

opendir my $dir, '.'; for my $ent ( readdir $dir ) { if(! -e $ent ) { print "'$ent' is read but does not exist" } };

produces any output. Of course, once you mix data from other sources than the file system and data from the filesystem functions, you need to be aware of the respective encodings and convert between them, but in absence of a short, self-contained example of Perl code (plus the type of file system and the filename, as hex), it's hard to advise you better.

You continue your post with a paragraph that starts with

The fix is simple...

I'm not sure how your fix would address the problems you encounter, and how your fix would maintain backwards compatibility. Feel free to posit your ideas to the perl5-porters mailing list, or even better, supply working code, as that has the greatest chance of moving Perl in the direction you seem to want.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://978845]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-04-24 04:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found