Python unicode and Windows cmd.exe

Guillermo guillermo.listas at
Sun Mar 14 22:53:11 CET 2010

>    The console is commonly using Code Page 437 which is most compatible
> with old DOS programs since it can display line drawing characters. You
> can change the code page to UTF-8 with
> chcp 65001

That's another issue in my actual script. A twofold problem, actually:

1) For me chcp gives 850 and I'm relying on that to decode the bytes I
get back from the console.

I suppose this is bound to fail because another Windows installation
might have a different default codepage.

2) My script gets output from a Popen call (to execute a Powershell
script [new Windows shell language] from Python; it does make sense!).
I suppose changing the Windows codepage for a single Popen call isn't

Right now, I only get the desired result if I decode the output from
Popen as "cp850".

More information about the Python-list mailing list