Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print unicode character with code bigger than four hex digits

I am trying to print emoticons on screen using unicode text for emoticons.

From a list of Emoticons from Wiki, I found that these are of the form U+1F6xx__ ie. 5 characters hexadecimal.

How am I supposed to print a smiley with text code as: U+1F60A

Please help.

like image 559
vish4071 Avatar asked Jun 26 '13 23:06

vish4071


People also ask

How do you print the Unicode of a character in Python?

To print any character in the Python interpreter, use a \u to denote a unicode character and then follow with the character code. For instance, the code for Ī² is 03B2, so to print Ī² the command is print('\u03B2') . There are a couple of special characters that will combine symbols.

What is the highest Unicode character?

The maximum possible number of code points Unicode can support is 1,114,112 through seventeen 16-bit planes. Each plane can support 65,536 different code points. Among the more than one million code points that Unicode can support, version 4.0 curently defines 96,382 characters at plane 0, 1, 2, and 14.

How do I insert a Unicode character in C++?

We can put the Unicode value with the prefix \u. Thus we can successfully print the Unicode character.

Which function is used to print the Unicode value of a character?

The ord function in python accepts a single character as an argument and returns an integer value representing the Unicode equivalent of that character.


1 Answers

Try the next with some font with support for this characters:

public static void main(String[] args) {
    for (int codePoint = 0x1F600; codePoint <= 0x1F64F;) {
        System.out.print(Character.toChars(codePoint));
        codePoint++;
        if (codePoint % 16 == 0) {
            System.out.println();
        }
    }
}

Output:

šŸ˜€šŸ˜šŸ˜‚šŸ˜ƒšŸ˜„šŸ˜…šŸ˜†šŸ˜‡šŸ˜ˆšŸ˜‰šŸ˜ŠšŸ˜‹šŸ˜ŒšŸ˜šŸ˜ŽšŸ˜
šŸ˜šŸ˜‘šŸ˜’šŸ˜“šŸ˜”šŸ˜•šŸ˜–šŸ˜—šŸ˜˜šŸ˜™šŸ˜ššŸ˜›šŸ˜œšŸ˜šŸ˜žšŸ˜Ÿ
šŸ˜ šŸ˜”šŸ˜¢šŸ˜£šŸ˜¤šŸ˜„šŸ˜¦šŸ˜§šŸ˜ØšŸ˜©šŸ˜ŖšŸ˜«šŸ˜¬šŸ˜­šŸ˜®šŸ˜Æ
šŸ˜°šŸ˜±šŸ˜²šŸ˜³šŸ˜“šŸ˜µšŸ˜¶šŸ˜·šŸ˜øšŸ˜¹šŸ˜ŗšŸ˜»šŸ˜¼šŸ˜½šŸ˜¾šŸ˜æ
šŸ™€šŸ™šŸ™‚šŸ™ƒšŸ™„šŸ™…šŸ™†šŸ™‡šŸ™ˆšŸ™‰šŸ™ŠšŸ™‹šŸ™ŒšŸ™šŸ™ŽšŸ™
like image 80
Paul Vargas Avatar answered Oct 07 '22 10:10

Paul Vargas