]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
fix json escaping
authorYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 30 Aug 2011 00:01:41 +0000 (17:01 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 30 Aug 2011 00:02:38 +0000 (17:02 -0700)
src/common/escape.c

index 78377726639c79f11a1641816d4b11b28e6e507b..95a7540ffcdfa5363ea4ad706054f13969ae05ee 100644 (file)
@@ -143,7 +143,7 @@ int escape_json_attr_len(const char *buf)
                default:
                        // Escape control characters.
                        if ((c < 0x20) || (c == 0x7f)) {
-                               ret += 5;
+                               ret += 6;
                        }
                        else {
                                ret++;
@@ -185,8 +185,8 @@ void escape_json_attr(const char *buf, char *out)
                default:
                        // Escape control characters.
                        if ((c < 0x20) || (c == 0x7f)) {
-                               snprintf(o, 6, "\\%04x", c);
-                               o += 5;
+                               snprintf(o, 6, "\\u%04x", c);
+                               o += 6;
                        }
                        else {
                                *o++ = c;