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".