Re: UTF-8 in Windows
- Posted by jcmarsh Sep 16, 2008
- 1282 views
Check which code page MS console is using when it starts up. (example: mode con) This might be the only code page v3.1.1 can output if it is not a unicode program. Also, this might be the only code page that puts() can display on the console screen if it only takes OEM code pages. Try running "ascii.bat" and see what characters display. puts(1, {164}) gives me the "n-yeah".
The default code page for MS console is OEM 437. It may be possible to substitute unicode values for OEM ones using this chart http://www.microsoft.com/globaldev/reference/oem/437.mspx
Here's a list of some localized MS operating systems and code pages http://www.microsoft.com/globaldev/reference/oslocversion.mspx
Note: English's OEM code page is 437, Spanish's OEM code page is 850. The difference between them is that 850 has more accented characters and 437 has more line art. (I think this is changed when changing the system's localization settings.)
Alternatively, you could switch between standard OEM code pages (example: mode con cp select=850) for displaying special characters that are not in the code page that console started in. Make sure to change it back to the default afterward (example, back to 437).
- Quote from a Wikipedia article (emphasis added):
- "Recent Microsoft products and application program interfaces use Unicode internally, but many applications and APIs continue to use the default encoding of the computer's locale when reading and writing text data to files or standard output. Therefore, though Unicode is the accepted standard, there is still backwards compatibility with the older Windows code pages." http://en.wikipedia.org/wiki/Windows_code_page