We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8aed182 commit 5d7f68fCopy full SHA for 5d7f68f
tests/TestSuite.c
@@ -555,21 +555,9 @@ TestSuite_RunFuncInChild (TestSuite *suite, /* IN */
555
static void
556
_append_json_escaped (bson_string_t *buf, const char *s)
557
{
558
- while (*s) {
559
- if (*s == '"') {
560
- bson_string_append_c (buf, '\\');
561
- bson_string_append_c (buf, '\"');
562
- } else if (*s == '\n') {
563
564
- bson_string_append_c (buf, 'n');
565
- } else if (*s == '\t') {
566
- bson_string_append (buf, " ");
567
- } else {
568
- bson_string_append_c (buf, *s);
569
- }
570
-
571
- s++;
572
+ char *escaped = bson_utf8_escape_for_json (s, -1);
+ bson_string_append (buf, escaped);
+ bson_free (escaped);
573
}
574
575
0 commit comments