1BSON_APPEND_UTF8(3)                 libbson                BSON_APPEND_UTF8(3)
2
3
4

SYNOPSIS

6          #define BSON_APPEND_UTF8(b, key, val) \
7             bson_append_utf8 (b, key, (int) strlen (key), val, (int) strlen (val))
8
9          bool
10          bson_append_utf8 (bson_t *bson,
11                            const char *key,
12                            int key_length,
13                            const char *value,
14                            int length);
15

PARAMETERS

17bson: A bson_t.
18
19key: An ASCII C string containing the name of the field.
20
21key_length: The length of key in bytes, or -1 to determine the length
22         with strlen().
23
24value: A UTF-8 encoded string.
25
26length: The number of bytes in value excluding the trailing \0, or -1
27         to determine the length with strlen().
28

DESCRIPTION

30       The  bson_append_utf8() function shall append a UTF-8 encoded string to
31       bson.
32
33       value MUST be valid UTF-8.
34
35       Some UTF-8 implementations allow for \0  to  be  contained  within  the
36       string  (excluding  the  termination  \0. This is allowed, but remember
37       that it could cause issues with  communicating  with  external  systems
38       that do not support it.
39
40       It  is  suggested to use modified UTF-8 which uses a 2 byte representa‐
41       tion for embedded \0 within the string. This will allow these UTF-8 en‐
42       coded strings to used with many libc functions.
43
44       Due  to  legacy  behavior, passing NULL for value appends a null value,
45       not a UTF8 value.  To  append  a  null  value  directly,  prefer  using
46       bson_append_null().
47

RETURNS

49       Returns  true  if  the operation was applied successfully. The function
50       will fail if appending the value grows bson larger than INT32_MAX.
51

AUTHOR

53       MongoDB, Inc
54
56       2017-present, MongoDB, Inc
57
58
59
60
611.25.1                           Nov 08, 2023              BSON_APPEND_UTF8(3)
Impressum