在visual c+中显示日语字符+; 有人知道如何在VisualC++中使用日语字符吗?

在visual c+中显示日语字符+; 有人知道如何在VisualC++中使用日语字符吗?,c++,visual-c++,cjk,C++,Visual C++,Cjk,我试图用VisualC++在控制台中显示日文名称。< /P> #include "stdafx.h" #include <string> #include <iostream> using namespace std; int main() { cout << "北島 美奈" << endl; return 0; } 希望有人能帮忙。谢谢。我已经用自己的代码在控制台窗口上使用cmd.exe测试了UTF-8和EUC-KR(韩语)

我试图用VisualC++在控制台中显示日文名称。< /P>
#include "stdafx.h"
#include <string>
#include <iostream>

using namespace std;

int main()
{
   cout << "北島 美奈" << endl;

   return 0;
}

希望有人能帮忙。谢谢。

我已经用自己的代码在控制台窗口上使用cmd.exe测试了UTF-8和EUC-KR(韩语)

这是我的源代码

#include <string>
#include <iostream>

#include <windows.h>

int main()
{
    int codepage = CP_ACP; //CP_ACP, CP_OEMCP
    int conv_codepage = CP_UTF8; //CP_UTF8
    char str[256];
    char str1[256];
    wchar_t tstr[256], tstr2[256];

    memset(str, 0x00, 256);
    memset(str1, 0x00, 256);
    memset(tstr, 0x00, 256);
    memset(tstr2, 0x00, 256);

    memcpy(str, " 北島 美奈", sizeof(str));

    int nLen = MultiByteToWideChar(codepage, 0, str, -1, 0, 0); 
    MultiByteToWideChar(codepage, 0, str, -1, tstr, nLen);

    int len = WideCharToMultiByte( conv_codepage, 0, tstr, -1, NULL, 0, 0, 0 ); 
    WideCharToMultiByte(conv_codepage, 0, tstr, -1, str1, len ,0 ,0);

    cout << "2... " << str1 << endl;

    return 0;
}
#包括
#包括
#包括
int main()
{
int codepage=CP_ACP;//CP_ACP,CP_OEMCP
int conv\u codepage=CP\u UTF8;//CP\u UTF8
char-str[256];
char-str1[256];
wchar_t tstr[256],tstr2[256];
memset(str,0x00,256);
memset(str1,0x00,256);
内存集(tstr,0x00,256);
内存集(tstr2,0x00,256);
memcpy(str,“北島 美奈", sizeof(str));
int-nLen=MultiByteToWideChar(代码页,0,str,-1,0,0);
多字节tetowidechar(代码页,0,str,-1,tstr,nLen);
int len=WideCharToMultiByte(conv_代码页,0,tstr,-1,NULL,0,0,0);
宽图表多字节(conv_代码页,0,tstr,-1,str1,len,0,0);

无法复制您是否尝试使用L“”,即cout@Nitesh,是,输出为:00057B30使用wcout。请参阅“Windows控制台应用程序中输出unicode字符串”的可能复制。我尝试了您的代码,在我的控制台上的输出为:2??
#include <string>
#include <iostream>

#include <windows.h>

int main()
{
    int codepage = CP_ACP; //CP_ACP, CP_OEMCP
    int conv_codepage = CP_UTF8; //CP_UTF8
    char str[256];
    char str1[256];
    wchar_t tstr[256], tstr2[256];

    memset(str, 0x00, 256);
    memset(str1, 0x00, 256);
    memset(tstr, 0x00, 256);
    memset(tstr2, 0x00, 256);

    memcpy(str, " 北島 美奈", sizeof(str));

    int nLen = MultiByteToWideChar(codepage, 0, str, -1, 0, 0); 
    MultiByteToWideChar(codepage, 0, str, -1, tstr, nLen);

    int len = WideCharToMultiByte( conv_codepage, 0, tstr, -1, NULL, 0, 0, 0 ); 
    WideCharToMultiByte(conv_codepage, 0, tstr, -1, str1, len ,0 ,0);

    cout << "2... " << str1 << endl;

    return 0;
}
cout << "2... " << str << endl;
cout << "2... " << str1 << endl;