in reply to Character encoding in console in Windows
binmode STDIN, ':encoding(UTF-8)';
First, you're assuming the terminal uses UTF-8. That's unlikely on Windows and not necessarily true on unix. chcp will tell you the current code page on a Windows system (usally cp1252).
Second, Perl's file operators expect file names to be string of bytes. If you decode them, you'll need to re-encode them.
Finally, If you have to deal with files whose name contain characters that don't exist in your code page, you'll encounter a third problem. See Re: stat() and utf8 filenames on Win32 fails for me, why? for a bit on that.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Character encoding in console in Windows
by elef (Friar) on Sep 14, 2010 at 09:49 UTC |