in reply to Outputting Unicode to DOS
In all likelyhood, all you need to do is change the codepage of the CLI session.
For example, the default codepage on my system is 850, and if I print your test string:
#! perl -slw use strict; my $str = "abc123äöüß"; print $str;
this is what I get:
C:\test>chcp Active code page: 850 C:\test>1140216.pl abc123õ÷³▀
But if I change the codepage to the Windows Unicode codepage 65000, I get this:
C:\test>chcp 65000 Active code page: 65000 C:\test>1140216.pl abc123äöüß
And if you need to automate the change of codepage, use:
use Win32::Console; ... Win32::Console::OutputCP( 65000 ); ...
BTW: The above was done using perl 5.10; and still works as is with more modern versions:
C:\test>\perl5.18\perl\bin\perl.exe 1140216.pl abc123äöüß C:\test>\Perl5.20\bin\perl.exe 1140216.pl abc123äöüß C:\test>\Perl22\bin\perl.exe 1140216.pl abc123äöüß
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Outputting Unicode to DOS
by Carbonblack (Novice) on Sep 06, 2019 at 08:52 UTC |