cjk32 has asked for the wisdom of the Perl Monks concerning the following question:
Then I get the following:ex("c:\\fil\x{e9}.txt"); ex("c:\\fil" . pack("U", 0xe9 ) . ".txt"); sub ex { my $f = shift; print $f; print ((-e $f) ? " exists" : " doesn't exist"); print "\n"; }
The filename is displayed in exactly the same format to the screen in both cases, but the file isn't found when the filename is passed as a utf8 string. Is there any way to tell perl that the operand being passed to -e is utf8? One workaround would be to simply convert everything from utf8 to an single byte representation, but I've no idea whether this will work in environments other than mine (Win32, EN_GB, perl v5.8.8). It's also not going to handle unicode characters that won't fit into a single byte either. What is the correct way to handle this to ensure portability? Chris Keyc:\filé.txt exists c:\filé.txt doesn't exist
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: utf8 filenames
by wazoox (Prior) on Apr 10, 2006 at 13:43 UTC | |
by cjk32 (Novice) on Apr 10, 2006 at 13:58 UTC | |
by wazoox (Prior) on Apr 10, 2006 at 17:58 UTC | |
|
Re: utf8 filenames
by Anonymous Monk on Apr 10, 2006 at 13:50 UTC | |
by cjk32 (Novice) on Apr 10, 2006 at 14:40 UTC | |
by jonadab (Parson) on Apr 10, 2006 at 15:22 UTC | |
by Anonymous Monk on Apr 10, 2006 at 21:20 UTC | |
|
Re: utf8 filenames
by graff (Chancellor) on Apr 11, 2006 at 03:23 UTC | |
|
Re: utf8 filenames
by zentara (Cardinal) on Apr 10, 2006 at 15:32 UTC | |
by Anonymous Monk on Apr 10, 2006 at 18:16 UTC |