+ 23
Special Characters
How can't we code Special Characters in C and C++ such as 🍉🍎 . Does C and C++ have unicode system declaring? Is it exit, lemme know.
13 Answers
+ 7
You can enable utf-16 by writing
_setmode(fileno(stdout), _O_U16TEXT);
and then you have to use BOM(byte-order mark) which tells the compiler how the encoding/decoding should be done.
wprintf(L"\xfeff") ;
You will be needing two libraries
fcntl.h and io.h for this purpose.
To print emoji
wprintf (L"\U0001f636");
wprintf (L"😊") ;
If you want to print with C++
wcout << L"\U0001f636";
wcout << L"😊";
+ 15
Coder you mean we can also use utf-16 or 32 in C and C++ too..right?
+ 14
Coder it's also stdlib.h header .right? Thanks
+ 14
I know it'll become kinda off topic, but pity you don't do python 🙂 we have a wonderful way to use utf 16 characters 😁
https://code.sololearn.com/cK0top56CXgL/?ref=app
+ 13
Coder yes it will work but it won't show the emoji. I guess it doesn't allow special characters.
+ 11
nAutAxH AhmAd found the answer 😁😁
Thanks
+ 2
Really useful. Thanks
+ 1
I think so