I'm stuck at a point where I have printed an sparkling emoji by using UTF - 16 (in code "emoji") , now further I want to add a ASCII character (177) in next line( as showed in code 'char' )
But there is problem after declaring utf-16 ..........in next line the following character is not displayed properly
Simply i want to combine "emoji" code following "char" code
Please also tell the reason why a character doesn't print with UTF - 16
\u2592 is a character code you need to use in your emoji code to print your desired character.
The decimal value in char code '177' is from the CP437(Code Page 437) which is the character set of IBM PC's.
This character set is being used by the compiler for output.
In emoji code, we changed the character set to UTF-16 which has different decimal values.
Standard ascii values for characters are same in all character sets i.e from. 0 - 127.
But different character sets have different ascii values in the extended ASCII i.e from 128 - 255.
So 177 in CP437 is equal to 9618
Here is a chart for you which shows the equivalent UTF-8/16 values from different character sets
I had figured it out already :) But thanks for mentioning it, will be useful for others.
I had initially printed it as
wprintf(L"\u9618") then with
wprintf("%c", 9618) then finally with wprintf(L"%c", 9618);
~ swim ~ Have you printed without using character literal, like this:
If that's the case, then you will see a Chinese character as ✳AsterisK✳ said.
You need to use character literal of type wchar_t which is 'L'
Then you should get the correct output as I got.
Or maybe you are not getting correct output because of the reason that you mentioned.
After some research i came to the same conclusion what nAutAxH AhmAd has already said that chars sets have different values for extended ascii char.
But the value 9618 prints a box not exactly it's equivalent in ascii mode.
Mods please handle this, its spamming alot.
Hatsy Rei Kinshuk Vasisht Ace ChillPill
[Edit by David Carroll]
nAutAxH AhmAd We deactivated the account that had spammed 1,961 messages in this question and almost 3,200 in another question.
Yes, <io.h> : header file is used to access _setmode(), a routine that sets stdout to Unicode, defined in the same file.
"It enables Unicode UTF-16
in SoloLearn C Playground."
This header file only works on windows that's why it won't work now on SL's server as it changes to Linux.
Here you learn more about its server -