+ 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

11th Sep 2019, 6:30 PM
Vinesh Wadhwani
Vinesh Wadhwani - avatar
25 odpowiedzi
+ 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
11th Sep 2019, 7:28 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 43
Thanks everyone for Answering 🙏💐😊💐🙏
12th Sep 2019, 6:48 PM
Vinesh Wadhwani
Vinesh Wadhwani - avatar
+ 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
20th Feb 2020, 8:06 AM
Vinesh Wadhwani
Vinesh Wadhwani - avatar
+ 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.
11th Sep 2019, 9:00 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 7
that looks like a Chinese character in a box ~ swim ~
11th Sep 2019, 8:43 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 7
Is there UTF-32? UTF-64?
15th Sep 2019, 10:32 AM
Adi Pratama
Adi Pratama - avatar
+ 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.
19th Sep 2019, 6:04 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 6
This erratic behavior many Compiler do posses Declaring another char variable in middle of your program you cannot 😉
13th Sep 2019, 2:56 PM
Aditya
Aditya - avatar
+ 5
David Carroll Thank you for the quick action.
19th Sep 2019, 6:39 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 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.
1st Jun 2020, 8:33 AM
pariii_kasliwal🎭
pariii_kasliwal🎭 - avatar
+ 3
Simple: deactivate the 🌟 at the bottom of the main message.
19th Sep 2019, 6:47 PM
Miquel Andreu Fuster Sancho
Miquel Andreu Fuster Sancho - avatar
+ 2
Is io.h is a valid header?
19th Feb 2020, 8:09 AM
Ankit Tiwari
Ankit Tiwari - avatar
+ 1
yes i want
13th Sep 2019, 3:24 PM
ritika
+ 1
am still getting tones of notifications
19th Sep 2019, 6:42 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 1
Miquel Andreu Fuster Sancho i did that, and it seem the user is ban
19th Sep 2019, 6:48 PM
✳AsterisK✳
✳AsterisK✳ - avatar
0
Hy sir
13th Sep 2019, 3:44 PM
Sai Krishan
Sai Krishan - avatar
0
Ĥum chic
10th Nov 2019, 3:28 PM
Higer
0
este el el lenguaje de futter?
15th Nov 2019, 4:00 PM
J. Saieg
J. Saieg - avatar
0
Bro your first program can not contains files named io.h inshort you write worng name of file in starting of the program
28th Sep 2020, 8:01 AM
[No Name]