![]() |
install examples documentation |
|
json-utf8 <text> \
[ status [ define ] <status> ] \
[ error-text [ define ] <error text> ]
// JSON Unicode value to encode to UTF8
char txt[] = "\u0459\\\"Doc\\\"\\n\\t\\b\\f\\r\\t\\u21d7\\u21d8\\t\\u25b7\\u25ee\\uD834\\uDD1E\\u13eb\\u2ca0\\u0448\\n\\/\\\"()\\t";
// Convert to UTF8
json-utf8 txt status define txt_status error-text define txt_error
// Expected UTF8 result
char utf8[] = "љ\"Doc\"\n\t\b\f\r\t⇗⇘\t▷◮𝄞ᏫⲠш\n/\"()\t";
// Make sure conversion was successful
if (strcmp (utf8, txt) || txt_status != VV_OKAY || txt_error[0] != 0) {
@Error in converting JSON string to UTF8
}