Anyone know how to count Unicode glyphs in Vala?

Eg., “🙄👈” = two glyphs

This is currently what I’m banging my head against.

#vala #unicode

To wit, what I’ve already tried:

- string.length returns bytes
- get_char_count() returns characters (eg. an emoji might be 5 characters)
- I can’t seem to find a way to split a string into an array of glyphs (in JavaScript: […str].length does the trick). e.g., string.split throws an error in Vala if called with an empty string as the delimiter.

#vala #unicode

Show thread

I must be missing something very basic here but can’t seem to find any resources online.

#vala #unicode

Show thread
Sign in to participate in the conversation
Librem Social

Librem Social is an opt-in public network. Messages are shared under Creative Commons BY-SA 4.0 license terms. Policy.

Stay safe. Please abide by our code of conduct.

(Source code)

image/svg+xml Librem Chat image/svg+xml