1BSON_UTF8_ESCAPE_FOR_JSON(3) libbson BSON_UTF8_ESCAPE_FOR_JSON(3)
2
3
4
6 char *
7 bson_utf8_escape_for_json (const char *utf8, ssize_t utf8_len);
8
10 • utf8: A UTF-8 encoded string.
11
12 • utf8_len: The length of utf8 in bytes or -1 if it is NULL terminated.
13
15 Allocates a new string matching utf8 except that special characters in
16 JSON are escaped. The resulting string is also UTF-8 encoded.
17
18 Both " and \ characters will be backslash-escaped. If a NUL byte is
19 found before utf8_len bytes, it is converted to "\u0000". Other
20 non-ASCII characters in the input are preserved.
21
23 A newly allocated string that should be freed with bson_free().
24
26 MongoDB, Inc
27
29 2017-present, MongoDB, Inc
30
31
32
33
341.25.1 Nov 08, 2023 BSON_UTF8_ESCAPE_FOR_JSON(3)