佚名通过本文主要向大家介绍了dos窗口,dos窗口怎么打开,怎么打开dos命令窗口,如何打开dos命令窗口,dos窗口是什么等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: DOS窗口下不能正常显示Unicode?
描述:
解决方案1:
描述:
_putts(_T("English汉字\n"));
我用Unicode格式输出的字符串,遇到汉字就结束了。
改成下面:
_tprintf_s(_T("%s\n"), _T("English汉字"));
其中汉字全变成了“?”
请问怎么解决这个问题?
如果不能直接解决,请问怎么把Unicode转成ANSI?
解决方案1:
use WideCharToMultiByte() to convert the unicode strings to MBCS
before I print them to console with printf().
Alternatively, you might try changing the console code page with chcp or
programatically (SetConsoleCP, SetConsoleOutputCP, SetFileApisToANSI). By default console uses OEM codepage.