Running the following command
perl -e "for (my $i = 0; $i < length($ARGV[0]); $i++) {print ord(substr($ARGV[0], $i, 1)), qq{\n}; }" αβγδεζ
on a Windows 7 cmd window with ActiveState Perl v5.14.2 produces the following result:
97
223
63
100
101
63
The above values are nonsensical and don't correspond to any known encoding, so trying to decode them with the approach recommended in How can I treat command-line arguments as UTF-8 in Perl? doesn't help. Changing the command window active code page doesn't change the results.
Your system, like every Windows system I know, uses by default the 1252 ANSI code page, so you could try to use
Note that cp1252 cannot represent all of those characters, which is why the console and thus Perl actually receives
There is a "Wide" interface for passing (almost) any Unicode code point to a program, but
Sorry, but this is a "you can't" type of situation. You need a different approach. Diomidis Spinellis suggests changing your system's ANSI code page as follows in Win7:
At this point, you'd use the encoding of the ANSI code page associated with the new selected encoding instead of
cp1252
(cp1253
for Greek).Note that using
chcp
to modify the code page used within the console window does not affect the code page in which Perl receives its arguments, which is always an ANSI code page. See the examples below (cp737 is the Greek OEM code page, and cp1253 is the Greek ANSI code page. You can find the encodings labeled as 37 and M7 in this document.)