1

The thing is that on non-english versions of XP code pages for console and gui apps differ, for example if I on my Polish version write in console:

echo zażółć gęślą jaźń > somefile.txt

The content of that file is:

zaľ˘† g©lĄ ja«ä 

This isn't happening if I put that into cmd file. That is this text with polish letters. But if I create a file or directory that is named using non English only chars, then no matter if it's run from cmd or from finger the effect is always gibberish.

So my question is how to get this second code page that rest of windows is running with. In my case this CP is 1250 - but how to get this number from c++ ?

GetConsoleCP() and GetConsoleOutputCP() both return 852 (which is correct) and GetThreadLocale() gives 1045.

If I try to chcp 1045 it gives "wrong code page".

rsk82
  • 28,217
  • 50
  • 150
  • 240
  • Possible duplicate of http://stackoverflow.com/questions/909913/how-can-i-programmatically-determine-the-current-default-codepage-of-windows – Greg May 22 '12 at 13:54

1 Answers1

3

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\ACP - this registry key stores the ANSI code page number (it should be 1250 in your case) and HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP stores OEM code page.

Oh, and there are GetACP and GetOEMCP functions.

n0rd
  • 11,850
  • 5
  • 35
  • 56