vendredi 16 novembre 2018

Why are Unicode Characters being replaced by Question Marks in C++?

I'm using Visual Studio 2017. I wanted to display a Malayalam(South Indian Language) character - 'അ'. Its Unicode Number is U+0D05. I tried the following code in Visual Studio:

#include "stdafx.h"
#include <iostream>
#include <io.h>
#include <fcntl.h>

using namespace std;

int main()
{
    _setmode(_fileno(stdout), _O_U16TEXT);
    std::wcout << L"Hello, \u0D05!\n";
    return 0;
}

But, I seemed to be getting the following output:

Hello, ?!

Can you tell me what's wrong with the code?

Aucun commentaire:

Enregistrer un commentaire