+ 55
[Solved] Need help in C
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 https://code.sololearn.com/c1A0JHPmfK4F/?ref=app https://code.sololearn.com/cHA1yWu1crw6/?ref=app
21 Respostas
+ 21
\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
https://www.acc.umu.se/~saasha/charsets/?charset=cp855&charset=cp437
+ 43
Thanks everyone for Answering
🙏💐😊💐🙏
+ 21
Ankit Tiwari
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 -
https://www.sololearn.com/post/166812/?ref=app
+ 8
~ swim ~ Have you printed without using character literal, like this:
wprintf("%c", 9618);
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'
wprintf(L"%c", 9618);
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.
+ 7
that looks like a Chinese character in a box ~ swim ~
+ 7
Is there UTF-32? UTF-64?
+ 7
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.
+ 6
This erratic behavior
many Compiler do posses
Declaring another char variable in middle of your program
you cannot 😉
+ 5
David Carroll Thank you for the quick action.
+ 5
✳AsterisK✳
Unicode handling in general is quite tricky especially on Windows. It's not only about matching charsets, the fonts needs to support the charsets too.
+ 3
Simple: deactivate the 🌟 at the bottom of the main message.
+ 2
Is io.h is a valid header?
+ 1
yes i want
+ 1
am still getting tones of notifications
+ 1
Miquel Andreu Fuster Sancho i did that, and it seem the user is ban
0
Hy sir
0
Ĥum chic
0
este el el lenguaje de futter?
0
Bro your first program can not contains files named io.h inshort you write worng name of file in starting of the program