+ utf16buf = (unsigned short *)malloc(2 * len + 16);
+ if (!utf16buf)
+ {
+ goto json;
+ }
+
+ utf16enclen = (int)utf8_to_utf16((unsigned char *)JSON_SAVE_BUFFER, len, utf16buf, len + 2);
+
+ encodebuf = (char *)malloc(utf16enclen * 4 + 16);
+ if (!encodebuf)
+ {
+ goto json;
+ }
+
+ for (i = 0; i < utf16enclen; i++)
+ {
+ scnprintf(encodebuf + i * 4, 5, "%04X", utf16buf[i]);
+ }
+
+json: