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.
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.
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.
We can put the Unicode value with the prefix \u. Thus we can successfully print the Unicode 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.
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:
๐๐๐๐๐๐
๐๐๐๐๐๐๐๐๐๐
๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐๐
๐ ๐ก๐ข๐ฃ๐ค๐ฅ๐ฆ๐ง๐จ๐ฉ๐ช๐ซ๐ฌ๐ญ๐ฎ๐ฏ
๐ฐ๐ฑ๐ฒ๐ณ๐ด๐ต๐ถ๐ท๐ธ๐น๐บ๐ป๐ผ๐ฝ๐พ๐ฟ
๐๐๐๐๐๐
๐๐๐๐๐๐๐๐๐๐
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With