Hi I am trying to print a string in c++, which is not in English, and the output is always ????
, for example, I want to print a korean world '선배'
or Thai word 'ยิ่ง'
, the simple code snippet is as follows-
main(){
string name("선배");// string name("ยิ่ง");
int len=name.size();
cout<<"\n name: "<<name;
cout<<"\n length "<<len;
}
OUTPUT:
name: ??
length 2
Where as if I change the string line by English character as-
string name("ab");
OUTPUT:
name: ab
length 2
Update: I also tried wchar_t
, which is also printing question marks.
code-
wchar_t *a=L"อดีตรักงานไหม";
wprintf(L"sss : %s \n" , a);
I checked the property of the project, project properties->configuration properties->general and the Character set is set as ' Use Unicode Charecter Set
'
Anybody can please tell me what is going wrong? How can I get it printing different languages?
regards