in reply to Unicode console output under Windows

Ouch. I'm no win32 expert, but it looks like there is too much conversion in that program
#!/usr/bin/perl -- use strict; use warnings; binmode STDOUT, ':encoding(UTF-8)'; my( $chcp ) = (`chcp`) =~ /(\d+)/; $chcp and qx!chcp 65001!; #now UTF-8 print "Hello, printing chr 900..950\n"; $|=1; for(900..950){ print $_, ' ',chr($_), ' '; print "\n" if 0 == $_ % 6; } $chcp and `chcp $chcp`; # restore original __END__

Replies are listed 'Best First'.
Re^2: Unicode console output under Windows
by Anonymous Monk on Oct 04, 2009 at 20:39 UTC
    I don't think changing the console's codepage is a good idea. If your script aborts or gets killed before restoring the codepage, the console will remain in UTF-8 mode for any other applications to come. And that's assuming nobody else is using the same console while your script is running.
    R. Diez