Working with the OEMCP and the ACP

by Michael S. Kaplan, published on 2006/01/02 13:31 -05:00, original URI: http://blogs.msdn.com/b/michkap/archive/2006/01/02/508576.aspx


Lelikas asked:

Michael hi!

Please tell me (if it possible) how can i switch in (win 2003 server standart rus) console font from 866 to 1251. The problem consists that messages from utilities (eg netdiag) deduce the text in English is remarkable. But names of the interface named in Russian, deduce in the coding 1251 (instead 866). And it is not read. How I can switch code page of the console from 866 to 1251?

Pleaase....

The fundamental difference between the OEM and ANSI code pages is not easiy thwarted, unfortunately.

It may only be a display issue, trying to read logs in Notepad (which does not use the OEMCP) in which case you can use edit.com or a tool that is designed to work with different codepages (which Notepad is not).

And there are of course tools like chcp.com can sometimes help, as can running the console as Unicode (cmd /u). There are even Win32 API functions like SetConsoleCP, SetConsoleOutputCP, SetFileApisToANSI, and others. But note that this does not affect the fact that some of these utilities know that they run in the console and thus are always using the OEMCP, no matter what you convert with. It might be best to work within that framework than to try to make the old tools do more than they may have been designed to do....

 

This post brought to you by "Д" (U+0414, CYRILLIC CAPITAL LETTER DE)


# Peter Ibbotson on 3 Jan 2006 8:04 AM:

Generally you can make most of these problems go away by using a full screen text mode cmd prompt which then means that chcp works "right"
I'm pretty sure that chcp reprogrammes the VGA card character set to give the right results.

# Antonis Gonos on 31 Mar 2006 12:04 PM:

Chcp  [codepage]
works for console windows.
You should use a Lucide fond instead of raster fonts to display the console windo and then you can see all characters!

# Michael S. Kaplan on 31 Mar 2006 12:09 PM:

Yes, Antonis -- but remember the limitations (such as the ones at http://blogs.msdn.com/michkap/archive/2006/03/06/544251.aspx). :-)

go to newer or older post, or back to index or month or day