Get ICU to produce output in UTF-8 using toUTF8
/toUTF8String
. (toUTF8String gives you a std::string
so .c_str()
to get the char*
that Jansson wants.
Unicode: How to integrate Jansson(JSON library) with ICU special UTF-8 data types?
Domanda
I've been developing a C application that expects wide range of UTF-8 characters, so I started using ICU library to support Unicode characters, but it seems things aren't working nicely with other libraries(mainly, jansson, a JSON library).
Even though jansson claims it fully supports UTF-8, it only expects chars as parameters(IIRC, a single byte isn't enough for Unicode chars), while ICU uses a special type called UChar
(16byte sized character, at least on my system).
Casting a Unicode character to a regular character doesn't seem like a solution to me, since casting bigger data to smaller ones will cause data lose. I tried casting anyway; it didn't work.
So my question would be: How can I make the two libraries work nicely together?
Soluzione