Does Python mess with the (unicode) code page?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Dec 8 15:12:30 EST 2009


En Thu, 03 Dec 2009 15:38:28 -0300, Roy Smith <roy at panix.com> escribió:

> We've got a windows executable which used to get run out of a shell  
> script
> (Cygwin bash) and is now being run with subprocess.Popen().  The windows
> app is misbehaving.  To make a long story short, the guy who wrote the  
> code
> in question says,
>
>> it's all based on the return values of the WinAPI calls GetACP and  
>> GetOEMCP
>> [...] so maybe Python is doing something like setting the active code  
>> page
>> and OEM code page prior to the point when they "exec" stuff?
>
> Does Python do these things?  I'm using Python 2.5.1.

Not that I know of (also, I don't know of any way to programmatically  
alter GetACP and GetOEMCP, they're global system settings).

A console application should use the console functions GetConsoleCP and  
GetConsoleOutputCP; Python itself calls them to derive sys.stdin.encoding  
and sys.stdout.encoding respectively, but only queries the value, never  
sets it. GetConsoleCP isn't necesarily the same as GetOEMCP.

-- 
Gabriel Genellina




More information about the Python-list mailing list