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