- Home /
TMP / Unicode | how to use unicode-combinations?
Hello Community. I'm working on a chat for our game and we would like to support emojis. We use Textmesh Pro to do so. however, various emojis use multiple hexnumbers to function properly like "1f1e6-1f1ec" but adding this value into Sprite Character Table Item in the Sprite-Asset turns it into 66F1F1EC and I'm not sure if that is correct. Additionally, I want to add the unicode via script since setting the unicodes of thousands of emojis by hand would be madnes. however, converting it into a uint doesn't seem to work.
UInt32.TryParse("1f1e6-1f1ec", System.Globalization.NumberStyles.HexNumber, null, out unicode) => returns false
Do I have to change the string befor trying to convert it or is this simply not possible?
Answer by Bunny83 · Mar 17, 2020 at 01:03 PM
The two Unicode code points 1f1e6 and 1f1ec do not really represent an emoji. They are just "regional indicator symbols". In your case it's AG which is the regional code for "Antigua and Barbuda". As you can read here only
Some Emoji implementations represent combinations of two “regional indicator” letters as a single flag symbol
However from a unicode point of view those are just two seperate characters representing "A" and "G". So the usual display of that combination is just AG
and not necessarily a single flag symbol. That's just a convenient interpretation by some unicode renderers but not really in the standard and not required.
Note that A
and G
are just part of a special character set (A-Z) in the unicode standard which should only be used for regional codes. Therefore a unicode renderer can choose to preplace those two characters by a known replacement (usually the country flag). However for example my Firefox does not display a flag symbol but just the two letters "A" and "G"
I guess that TMP and the corresponding fonts used just don't do those replacements.
ps: UnityAnswers did not allow me to actually use the unicode letters we just talked about. UnityAnswers didn't allow me to include the actual unicode characters. $$anonymous$$aybe we can use html escapes:
edit yes that worked ^^. However as I said my browser does just display and "A" and a "G" for 🇦🇬
Answer by Benedikt_Zoeller · Mar 17, 2020 at 02:09 PM
I actually got a similar result when trying to add the uint of the two unicodes together (just trying weird things out). I converted the unicodes separately (in my example 1f1e6 and 1f1ec), added them together and now, Emojis that consist of more than one icon are being portrayed with a fitting combination of Emojis. Doing this for flags shows two letter-emojis representing the regional indicator for the flag. Trying to use a emoji with a darker skin-tone adds the yellow version of the emoji and a single-color emoji of the desired color.
I'm not sure if this means i'm going in the right direction or that TextMesh Pro doesn't support combining different Emoji-Unicodes.
Your answer
