(off-topic) Something like Rust's strings for C?


#1

I need to do some C programming but C doesn’t have UTF-8 strings in its stdlib. What’s the go-to library for this sort of thing?


#2

I haven’t done any proper C project in last 1-2 years, so apply salt etc.

IBM’s ICU is supposedly the most mature one, but I also found it really difficult to use(might be my problem).

I would probably go for utf8proc, which is now maintained by the Julia Language team and used in Julia as well, mostly because it seems more modern and smaller as it only does UTF-8.

You will see some several other C/C++ libraries mentioned in stackoverflow answers etc, but I was never sure how well tested they were as they seemed like one-off projects.


#3

Thanks, utf8proc looks amazing (mostly because the Julia team is amazing).


#4

utf8proc was originally “developed by Jan Behrens and the rest of the Public Software Group, who deserve nearly all of the credit for this package” (as mentioned on the repo README). (Felt like clarifying here just for attribution)

But yes, when you have a language development team supporting and using a library you can expect it to be very good indeed.