我想显示\xe2\x88\x9e具有 Unicode 的无穷大符号U+221E。我目前正在使用fmt库,它应该有很多支持并且是跨平台的。
fmt::print("", fmt::styled("\xe2\x88\x9e >", fmt::emphasis::bold | fg(fmt::color::aquamarine)));\nRun Code Online (Sandbox Code Playgroud)\n我得到以下输出:
\n? >\nRun Code Online (Sandbox Code Playgroud)\n我也尝试过设置:setlocale(LC_ALL, "en_US.UTF-8");没有帮助。我使用的是 Windows 11 x64。
警告:
\nwarning C4566: character represented by universal-character-name \'\\u221E\' cannot be represented in the current code page (1252)\nRun Code Online (Sandbox Code Playgroud)\nMS Visual Studio 2022 IDE。
\n我应该在项目属性中更改字符集吗?当前设置为:使用 Unicode 字符集,第二个选项是:使用多字节字符集。
\n