Support for iterating Unicode grapheme clusters #123

Open
opened 2026-06-07 13:12:52 +02:00 by Ghost · 3 comments

Since you said the internal representation of strings in ObjFW is UTF-8 (ObjFW/discussions#14 (comment)).

We will have proper reverse method for string (fix #115).

There are other options you could choose if you don't like utf8proc, e.g, libunistring.

I think you can implement it the same way you implement TLS support in ObjFW: being able to use multiple backends.

Since you said the internal representation of strings in ObjFW is UTF-8 (https://git.nil.im/ObjFW/discussions/issues/14#issuecomment-326). We will have proper `reverse` method for string (fix https://git.nil.im/ObjFW/ObjFW/issues/115). There are other options you could choose if you don't like utf8proc, e.g, libunistring. I think you can implement it the same way you implement TLS support in ObjFW: being able to use multiple backends.
Owner

ObjFW will not add any dependencies with TLS being the only exception - and that is planned to be temporary, too. ObjFW already has its own Unicode support that just needs to be extended, which is blocked on things such as #3 and #4.

That being said, there is nothing stopping someone from writing a library that uses utf8proc, libunistring or icu to add additional methods to OFString via a category. So you can just add it yourself!

ObjFW will not add any dependencies with TLS being the only exception - and that is planned to be temporary, too. ObjFW already has its own Unicode support that just needs to be extended, which is blocked on things such as #3 and #4. That being said, there is nothing stopping someone from writing a library that uses utf8proc, libunistring or icu to add additional methods to OFString via a category. So you can just add it yourself!
js changed title from Make OFString grapheme cluster aware with utf8proc to Add support for iterating Unicode grapheme clusters 2026-06-07 14:22:24 +02:00
js changed title from Add support for iterating Unicode grapheme clusters to Support for iterating Unicode grapheme clusters 2026-06-07 14:22:46 +02:00

That being said, there is nothing stopping someone from writing a library that uses utf8proc, libunistring or icu to add additional methods to OFString via a category. So you can just add it yourself!

I already have something like this, even though only the reverse method implemented. All thank to the LLMs.

But I would love to see new progress from your native implementation. Unicode is hard, so it's understandable that the very first issues like #3 and #4 are preserved for Unicode and are still not addressed.

> That being said, there is nothing stopping someone from writing a library that uses utf8proc, libunistring or icu to add additional methods to OFString via a category. So you can just add it yourself! I already have something like this, even though only the `reverse` method implemented. All thank to the LLMs. But I would love to see new progress from your native implementation. Unicode is hard, so it's understandable that the very first issues like #3 and #4 are preserved for Unicode and are still not addressed.
Owner

The number of the issues is random, as they were migrated from Fossil in random order 😉.

#3 is mostly done already in https://git.nil.im/ObjFW/ObjFW/src/branch/unicode-normalization.

The number of the issues is random, as they were migrated from Fossil in random order 😉. #3 is mostly done already in https://git.nil.im/ObjFW/ObjFW/src/branch/unicode-normalization.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
ObjFW/ObjFW#123
No description provided.