English 中文(简体)
视频工作室控制台输出错误字符
原标题:Visual Studio console outputting wrong characters

我正在用字符 进行一个项目。 目前,我有这样的代码:

const char dark = 0xB2;
const char light = 0xB0;
cout << dark;
cout << light;

此代码非常精细, 并输出出我笔记本电脑和其他桌面上的正确字符, 但在我的主桌面上, 此代码会输出字符 < code_ / code >, 而不是光阴影 和 < code_ / code >, 而不是暗阴影 。

我假设我在视觉工作室使用错误的字符集或其他设置, 但这是一个全新的装置, 我还没有碰过类似的东西, 就像我说的,它对我的另外两部个人电脑很好。

问题回答

您正在使用基本 ASCII 集( 0-127) 外的 < code>char 值,所以其解释和显示在很大程度上取决于控制台配置用于使用的特定字符集。

例如,IBM850字符集(编码第850页)具有您感兴趣的字符,而字符集JIS_X0201(编码第50222页)则输出您为相同的 charle 值提及的其他字符。

如果您需要为输出使用特定的字符集, 请尝试使用 < a href=" https://learn. microsoft. com/ en- us/ windows/ connole/ seconoleoutputcp" rel= “ nofollow noreferrer"\\ code > SetConsolePutputCP () 。

The character encoding for my pc was incorrect. I did this and it fixed the issue: https://scholarslab.github.io/learn-twarc/08-win-region-settings





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?