Sublime Forum

Ctypes.windll.kernel32.GetConsoleCP()

#1

ctypes.windll.kernel32.GetConsoleCP() returns always 0 from within Sublime Text. Is this a consequence of Python being embedded?

0 Likes

#2

I’d it’s because there is no console associated with the current process. I won’t ask why you want to get the current code page, but perhaps the win32 function GetACP() will give you what you’re after?

0 Likes

#3

I might be doing something wrong --no wait, I surely am doing something wrong–, but I’m interfacing with Powershell from a sublime plugin and the whole OEM/Ansi codepage business in Windows requires me to know what codepage the console’s currently using. I found a workaround, but I thought it’d be cleaner to get the codepage from python…

http://bitbucket.org/guillermooo/powershellutils/src/b722eb9bd360/executepscommand.py#cl-106

0 Likes