forked from lda/telodendria
Fix Unicode handling.
This commit is contained in:
parent
539fde773f
commit
3054a80906
2 changed files with 3 additions and 21 deletions
|
@ -376,26 +376,8 @@ JsonEncodeString(const char *str, Stream * out)
|
|||
length += 2;
|
||||
break;
|
||||
default: /* Assume UTF-8 input */
|
||||
/*
|
||||
* RFC 4627: "All Unicode characters may be placed
|
||||
* within the quotation marks except for the characters
|
||||
* that must be escaped: quotation mark, reverse solidus,
|
||||
* and the control characters (U+0000 through U+001F)."
|
||||
*
|
||||
* This technically covers the above cases for backspace,
|
||||
* tab, newline, feed, and carriage return characters,
|
||||
* but we can save bytes if we encode those as their
|
||||
* more human-readable representation.
|
||||
*/
|
||||
if (c <= 0x001F)
|
||||
{
|
||||
length += StreamPrintf(out, "\\u%04x", c);
|
||||
}
|
||||
else
|
||||
{
|
||||
StreamPutc(out, c);
|
||||
length++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
|
|
2
TODO.txt
2
TODO.txt
|
@ -45,7 +45,7 @@ Milestone: v0.4.0
|
|||
use the default. This will make debugging a lot easier.
|
||||
[ ] Make sure admin registration token is printed to log, not stdout.
|
||||
Unless they are the same, of course.
|
||||
[ ] Fix Json UTF-8 handling.
|
||||
[x] Fix Json UTF-8 handling.
|
||||
|
||||
Milestone: v0.5.0
|
||||
-----------------
|
||||
|
|
Loading…
Reference in a new issue