Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Fileopening question

by zentara (Archbishop)
on Apr 03, 2006 at 11:41 UTC ( #540902=note: print w/replies, xml ) Need Help??


in reply to Fileopening question

Since you are taking "general purpose", here is a little routine that handles a commonly appearing problem now-a-days, where your encoding can't handle special (but legal) characters in filenames. It won't affect anything, if the filenames are normal ascii, but will fix them, so Perl can find them from the filesystem, if there is a unicode character in them. I was shown this, when I had a problem opening files with Perl, which had names like Claude Gellée , where the funny é is actually an acented e. See Re: problems with extended ascii characters in filenames
#this decode utf8 routine is used so filenames with extended # ascii characters (unicode) in filenames, will work properly use Encode; opendir my $dh, $path or warn "Error: $!"; my @files = grep !/^\.\.?$/, readdir $dh; closedir $dh; # @files = map{ "$path/".$_ } sort @files; #$_ = decode( 'utf8', $_ ) for ( @files ); @files = map { decode( 'utf8', "$path/".$_ ) } sort @files;

I'm not really a human, but I play one on earth. flash japh

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2022-01-26 21:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (70 votes). Check out past polls.

    Notices?