我想打印 ▌ 符号到控制台。 我试过了
printf(L"▌");
和
wchar_t t = L'\u2588';
wprintf(L"%c\n", t);
但我只得到'?'结果。 我使用 Visual Studio 2012
更新
如果我将语言环境设置为en-US
setlocale(LC_ALL, "en-US");
我得到 |
for █
,+
for ╫
和 _
for ▄
最佳答案
要在控制台中启用 unicode,我们应该使用 _setmode(_fileno(stdout), _O_U16TEXT);
#include <stdio.h>
#include <io.h>
#include <fcntl.h>
void main()
{
_setmode(_fileno(stdout), _O_U16TEXT);
wprintf(L"█");
}
关于c - 如何将 unicode 符号打印到控制台,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22050684/