Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with UTF-8 texts between windows and *NIX #52698

Closed
kuhnchris opened this issue Sep 15, 2021 · 6 comments
Closed

Issues with UTF-8 texts between windows and *NIX #52698

kuhnchris opened this issue Sep 15, 2021 · 6 comments

Comments

@kuhnchris
Copy link

Godot version

3.3.3.stable

System information

Windows 10, GLES3, Linux (Arch) GLES3, Android

Issue description

When trying to work with a RichTextEdit everything works fine, the special [font] tag allows me to add smileys inline. All of this works dandy fine in Linux and Android, but on Windows we have the issue that the smiley copied from here: https://en.wikipedia.org/wiki/Emoticons_(Unicode_block)
are not visible in the editor anymore. Even worse, when trying top "copy" the unicode smileys from there, we have the following in the RichTextEdit, and no smiley available on display.
image
Same on Linux, but with working rendering:
image

I assume this is a Unicode/Windows/Locale/... issue - but are there any pointers or hints on how to work around that?

Steps to reproduce

Minimal reproduction project

https://github.com/kuhnchris/godot-sandbox-whatsapp-but-not/

@bruvzg
Copy link
Member

bruvzg commented Sep 15, 2021

This is known issue.

Godot 3.x use wchar_t as a string char type (on Windows it's 16-bit, on other platforms 32-bit), and do not have surrogate pair support. It can't display characters with charcode > 0xffff on Windows. Fixing it would be breaking change and unlikely to happen for 3.x.

Godot 4.x use 32-bit char32_t for strings on all platforms and do not have this issue.

@akien-mga
Copy link
Member

This is not the first time this comes up, is there a place we could document this in 3.x so that's it's known why it doesn't work, and that it won't be fixed in 3.x?

@bruvzg
Copy link
Member

bruvzg commented Sep 15, 2021

Or we can add partial support for surrogates to the dynamic font, input won't work entirely correctly, but displaying emojies should be possible without breaking changes (and it's probably the most common use for it, at least all previous issues were about emojies).

draw_char/get_char_size do receive next char for kerning anyway, we can use it to combine surrogates.

@kuhnchris
Copy link
Author

kuhnchris commented Sep 15, 2021

This is not the first time this comes up, is there a place we could document this in 3.x so that's it's known why it doesn't work, and that it won't be fixed in 3.x?

I checked the RichTextEdit doc first, I assumed if there is anything regarding that it would be there.
Or a separate "Unicode" section?

@Calinou
Copy link
Member

Calinou commented Sep 15, 2021

This was originally reported in #23093.

I agree that adding support for surrogates in 3.x would be a welcome change.

@akien-mga
Copy link
Member

Fixed by #54625.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants