in reply to Re^4: Character encoding in console in Windows
in thread Character encoding in console in Windows
So reading the console's encoding (which depends on OS localization) and then converting the incoming text in Perl accordingly sounds better to me... but I'm just taking stabs in the dark. I can't follow half of the posts here, but I can't see working code in any of them so far.
BTW as I said before, this is just one half of the issue...and save this in UTF-8, it would still fail to open the file. It seems pretty clear that I'd need to use one of the modules to ever be able to open a file with a non-ASCII name, and I can't really make sense of the documentation of the modules.#!/usr/bin/perl use strict; use warnings; use utf8; open(FILE, "<:encoding(UTF-8)", "c:\\folder\\í.txt") or print "Oops, c +an't open file: $!"; <STDIN>;
So the step-by-step seems to be:
1) read what the console's OEM encoding is
2) convert filepath received via STDIN from OEM to UTF-8
3) open the file using one of the Unicode modules
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Character encoding in console in Windows
by ikegami (Patriarch) on Sep 18, 2010 at 01:49 UTC | |
by elef (Friar) on Sep 18, 2010 at 08:16 UTC |