Godot version:
Godot 3.1 master https://github.com/godotengine/godot/commit/0d8284d3d4f439e074bf498af81e8c73be23cc67
OS/device including version:
Window 10
Issue description:
In theory, emoji support was added with this PR https://github.com/godotengine/godot/pull/15780 but I've been testing it and I can't get it to work. I tested it with the NotoColorEmoji.ttf font. That's the font I think @volzhs used for both that PR and this issue https://github.com/godotengine/godot/issues/10873 but I couldn't make it work. The font doesn't work on windows (opening it with the font viewer throws an error) because Windows doesn't support the type of color font https://github.com/googlei18n/noto-emoji/issues/43 But I'm not sure if it has anything to do with the issue.
Steps to reproduce:
did you compile with builtin_freetype option?
scons platform=windows builtin_freetype=yes
I didn't specify builtin_freetype=yes explicitly but it's on by default. I tried just in case and still nothing. When I c&p an emoji from the internet this is how it shows in the inspector but nothing shows in the actual label.
I tried a couple of other emojis and some did work like ✔

I also tried using a PoolByteArray and push the utf-8 bytes in there but no luck either. I tried:
func _ready():
var bytes = PoolByteArray()
bytes.push_back(0xF0)
bytes.push_back(0x9F)
bytes.push_back(0x98)
bytes.push_back(0x84)
text = bytes.get_string_from_utf8()
Which should be this one https://apps.timwhitlock.info/unicode/inspect?s=%F0%9F%98%84
Most emotes have char codes > 0xFFFF.
Godot string is based on wchar_t which is 16-bit on Windows, convention from UTF-8 replaces chars with codes above 0xFFFF with spaces, ustring.cpp#L1497 and Godot doesn't support UTF-16 surrogate pairs (and Windows copy-paste probably use UTF-16).
On Linux an macOS wchar_t is 32-bit and all emotes should work fine.
Oh well, I updated the title of the issue to reflect that information. Thanks @bruvzg
To be precise Unicode supplementary planes have much more stuff, not just emojis.
BiDi/Shaping PR (#21791) I'm working on, should fix rendering of > 0xFFFF chars on all platforms, but wchar_t size difference still cause some input problems on Windows and excessive encoding conversions on Linux/macOS.
How a bout switch to char32_t?
How a bout switch to
char32_t?
char32_t and char16_t are C++11 types and Godot currently targets C++03.
And it's probably better to switch to UTF-16 instead for several reasons:
I wrote some code to handle utf code conversion in c++ somewhere. I can take a look for it. wchar on windows is really quite a pain in the butt, but it can be worked with.
update: I would love to be able to 😏 people in game :^)
Godot is gonna support C++11 soon so what's the status on this? Are we using UTF-16?
It's time to switch to char16_t or something else, as Godot now targets C++11.
The same goes for Godots ord() where nearly all emojis return 32 (32 is actually the space " "), meaning that the emojis aren't recognized at all. ☹
Most helpful comment
Most emotes have char codes > 0xFFFF.
Godot string is based on
wchar_twhich is 16-bit on Windows, convention from UTF-8 replaces chars with codes above 0xFFFF with spaces, ustring.cpp#L1497 and Godot doesn't support UTF-16 surrogate pairs (and Windows copy-paste probably use UTF-16).On Linux an macOS
wchar_tis 32-bit and all emotes should work fine.