首页 > 解决方案 > std::wcout,为什么打印的字符和输入的不一样?

问题描述

尝试使用 std::wcout 打印“é”时,输出控制台改为打印“Ú”

https://www.utf8-chartable.de/unicode-utf8-table.pl使用这个网站我尝试使用 L"é" 或它的字符代码 0x00E9 打印 "é" 但我总是以 "Ú" 字符结束相反, std::cout << "é" 也产生相同的输出

#include <iostream>
#include <string>

int main()
{
    // Prints the weird U
    std::wcout << static_cast<wchar_t>(0x00E9);
    // Also prints the weird U
    std::wcout << L"é";
    // Also prints the weird U
    std::cout << "é";
    return 0;
}

`

那么,谁能指出我做错了什么?

标签: c++stringunicodeunicode-string

解决方案


推荐阅读