Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write unicode character farsi in C++ in ms-dos console?

Tags:

c++

farsi

persian

How to write unicode character farsi in c++ in ms-dos?

cout<<"Helo world"<<"سلام جهان";

like image 984
Samiey Mehdi Avatar asked Jan 30 '10 18:01

Samiey Mehdi


1 Answers

#include <iostream>
#include <locale>
#include <string>

int main()
{
      using namespace std;
      wstring wcs = L"中文";
      locale old = wcout.imbue(locale("") ); // "" is environment's default locale
      wcout<<wcs<<endl;
      wcout.imbue(old );                     // restore old locale
}
like image 141
OwnWaterloo Avatar answered Oct 20 '22 00:10

OwnWaterloo