John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:
Well, first of all the default STDOUT behavior seems to truncate characters to 8 bits and warn if the ordinal was >255, NOT do a encoding translation to the current character set.
If the "current" set of 256 characters (the Code Page) is enough and I don't worry about UTF-8, the results in the Console don't match what appears in the source. That's because the Windows Code Page is 1252, but for compatibility with old text-mode code from DOS, the Console uses the old DOS code page by default.
So, I use the commands
at the prompt, expecting it will not match the rest of the machine.chcp 1252 mode con cp select=1252
Nope! The results of programs running standard output, or the type command, etc. are still showing the DOS characters.
Anybody know the right incantation to make the Windows Console use the desired code page in this manner?
Better yet, is there a way to make Perl's output use the full Unicode capability of the Console? I'm thinking that a tie'd handle could feed to the Win32 API functions, skipping the OS's file stream.
Best of all, is there a way to make the OS's stream (that's attached to the Console) use UTF-8? That would work with any program, not just Perl.
—John
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Character Encoding and Windows Console woes
by BrowserUk (Patriarch) on Feb 16, 2004 at 21:29 UTC | |
by John M. Dlugosz (Monsignor) on Feb 16, 2004 at 21:37 UTC | |
by BrowserUk (Patriarch) on Feb 16, 2004 at 22:05 UTC | |
by John M. Dlugosz (Monsignor) on Feb 17, 2004 at 05:08 UTC | |
by Anonymous Monk on Feb 17, 2004 at 03:06 UTC | |
by John M. Dlugosz (Monsignor) on Feb 17, 2004 at 05:12 UTC | |
|
Re: Character Encoding and Windows Console woes
by John M. Dlugosz (Monsignor) on Feb 19, 2004 at 05:40 UTC | |
by soliplaya (Beadle) on Mar 17, 2007 at 14:26 UTC |