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

Not all emojis can be represented as fixed 32 bit values #475

Open
jurriaan opened this issue Mar 28, 2024 · 4 comments
Open

Not all emojis can be represented as fixed 32 bit values #475

jurriaan opened this issue Mar 28, 2024 · 4 comments

Comments

@jurriaan
Copy link
Contributor

jurriaan commented Mar 28, 2024

Noticed that in Waypoint and the Data messages emojis are represented using fixed 32 bit values:

/*
* Designator icon for the waypoint in the form of a unicode emoji
*/
fixed32 icon = 8;
and
/*
* Defaults to false. If true, then what is in the payload should be treated as an emoji like giving
* a message a heart or poop emoji.
*/
fixed32 emoji = 8;

Noticed in the Android app that for waypoints some emojis don't work, or show different icons. For example, the pirate flag emoji just shows as a black flag on the map.

@garthvh
Copy link
Member

garthvh commented Mar 28, 2024

Fixed32 works fine, must be an encoding / emoji issue on android
IMG_2289

@jurriaan
Copy link
Contributor Author

jurriaan commented Mar 28, 2024

@garthvh that's a text message, not a waypoint.

If you look at the payload of that message (f09f8fb4e2808de298a0efb88f), you'll see that emojis like this pirate flag actually consists of multiple unicode codepoints. (The Pirate Flag emoji is a ZWJ sequence combining 🏴 Black Flag, Zero Width Joiner and ☠️ Skull and Crossbones. See https://emojipedia.org/pirate-flag)

If you create a waypoint using that emoji it won't work properly as it consists of multiple unicode codepoints, since the android app for example only uses the first codepoint, the black flag (🏴):
https://github.com/meshtastic/Meshtastic-Android/blob/61be6e9985a0609423b62ff77ad7c2bc6684d61b/app/src/main/java/com/geeksville/mesh/ui/map/components/EditWaypointDialog.kt#L150

Which makes sense as you won't be able to fit these three characters in a 32 bit value.

@ianmcorvidae
Copy link
Contributor

I'm not sure how desirable it is to support zero-width joiner emoji for waypoint icons like this; in theory those values could get pretty long (even just in the "recommended sequences" list the Unicode consortium puts out, some are as long as 8 code points, from what I found, and I would not be surprised if there are longer ones supported some places). The example pirate flag is already 4, when correctly encoded, since it needs the zero-width joiner and a variation selector. Maybe it's possible to leave some things like that off and compute a correct value, though I wouldn't necessarily count on it. No idea how much headroom we have in these messages right now/how much we'd want to allow.

The apps should probably at least be validating that waypoint icons are in fact within whatever limit is applicable (currently, one Unicode codepoint within the right ranges, presumably)

@jurriaan
Copy link
Contributor Author

jurriaan commented Mar 28, 2024

@ianmcorvidae Yes, I think that does make sense!

In that case it's probably good to update the protobuf documentation for those fields as well to include that supporting a single codepoint for emojis is a design decision.

@jurriaan jurriaan changed the title Emojis should not be represented as fixed 32 bit values Not all emojis can be represented as fixed 32 bit values Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants