简体   繁体   English

表示错误的扩展字符

[英]Wrong extended characters are represented

I couldn't find any related answer to my question and I want to have a string like "╔══╗" but wrong characters are represented instead of them.我找不到任何与我的问题相关的答案,我想要一个像“╔══╗”这样的字符串,但是用错误的字符代替它们。 I found the issue and that was because of signed characters and that values of each character is different with ascii table value of element.我发现了这个问题,那是因为有符号字符,并且每个字符的值与元素的 ascii 表值不同。 How can I do that with char in c++?如何使用 c++ 中的 char 来做到这一点?

int main() {
    char a[] = "╔══╗";
    std::cout << a << std::endl;
}

use std::wstring (included in <string> ) and L"..." :使用std::wstring (包含在<string>中)和L"..."

#include <string>

int main(/**/)
{
    std::wstring wstr = L"╔══════════════╗";
}

NOTE: There is no good cross-platform way of printing such a string.注意:没有很好的跨平台方式来打印这样的字符串。 See How to print a wstring?请参阅如何打印 wstring? , How to print a wstring on MacOs or Unix? , 如何在 MacOs 或 Unix 上打印 wstring? , C++ wide character locale doesn't work . , C++ 宽字符区域设置不起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM