DOS窗口下不能正常显示Unicode?
_putts(_T("English汉字\n"));
我用Unicode格式输出的字符串,遇到汉字就结束了。
改成下面:
_tprintf_s(_T("%s\n"), _T("English汉字"));
其中汉字全变成了“?”
请问怎么解决这个问题?
如果不能直接解决,请问怎么把Unicode转成ANSI?
问题点数:100、回复次数:2Top
1 楼jiangsheng(蒋晟.Net[MVP])回复于 2006-03-20 07:44:15 得分 100
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.
Top
2 楼fanzai(帆仔)回复于 2006-03-21 21:54:30 得分 0
昨天忘了看论坛,不好意思:)
多谢!Top




