我在 Visual Studio 2008 中看不到俄文字母

Mar*_*ria 5 c++ unicode console visual-studio-2008

我正在尝试在 Visual Studio 2008 中输出俄语单词。我写道:

#include <iostream>
#include <locale.h>
using namespace std;

void main()
{
    setlocale(LC_ALL,"rus");
    cout << "? ???? ?????? ??? ??-??????!";
}
Run Code Online (Sandbox Code Playgroud)

当我在 Visual Studio 中按Ctrl+S保存文件时,收到以下提示:

此文件中的某些 Unicode 字符无法保存在当前代码页中。你想把它保存在 unicode 中吗?

我选择了“使用其他编码保存”选项并选择了“西里尔文 (Windows) - 代码页 1251”。但是,当我运行我的程序时,控制台输出显示如下:

???????? ??? ????
Run Code Online (Sandbox Code Playgroud)

Apo*_*kal 4

问题是您没有使用 Unicode 字符集(wstring、wcout 如 @\nB\xc3\xacnh Nguy\xc3\xaan 已经提到过)。有两种方法可以解决这个问题:

\n1. 使用unicode字符集。
\n2. 转到控制面板 -> 区域和语言 -> 管理选项卡 -> 非 Unicode 程序的语言 -> 更改系统区域设置... -> 选择俄罗斯。

\n