3

I'm currently using char * for strings in my C program. I'd like to learn how to implement Unicode support and have been looking at utf8proc.

Is utf8proc the best general-purpose Unicode library for C? Other than the documentation in the header file, are there examples for its use?

For instance, I can figure out how to compile utf8proc into my codebase, but other than that, I'm at a loss — do I keep using char * or do I use some other type? Stuff like that is not well described.

If there are better libraries or better-documented libraries, what should I be looking at?

3
  • 1
    What functionality are you looking for? Splitting UTF-8 into characters? into glyphs? Converting between representations? Character classes (e.g. figuring out what's whitespace)? … Jan 17, 2015 at 13:10
  • If you want to handle all of Unicode, you will need to look for a UTF-16 library, not UTF-8.
    – oldmud0
    Jan 18, 2015 at 22:40
  • I want to let users stream a data matrix with labeled rows and columns (potentially containing Unicode characters) into my program, and my program processes that data matrix into an internal data store. My program then processes that data store and renders it into an SVG file, which may contain Unicode-formatted strings placed at specific locations. So I want to know how to support reading and writing those kinds of strings. I can deal with ASCII because (unsigned) char * does that for me. I want to be able to support non-ASCII-speaking users, however. Does that help clear things up? Jan 18, 2015 at 22:45

1 Answer 1

1

Not a library as such, but I wrote some UTF-8 functions for my own C projects, which you can find here in the unicode.h and unicode.c files. They use the MIT licence so you can basically do whatever you want with them.

1
  • Thanks, I'll check this out. Jan 18, 2015 at 22:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.