1BSON_ITER_UTF8(3) libbson BSON_ITER_UTF8(3)
2
3
4
6 #define BSON_ITER_HOLDS_UTF8(iter) (bson_iter_type ((iter)) == BSON_TYPE_UTF8)
7
8 const char *
9 bson_iter_utf8 (const bson_iter_t *iter, uint32_t *length);
10
12 • iter: A bson_iter_t.
13
14 • length: An optional location for the length of the resulting UTF-8
15 encoded string.
16
18 The bson_iter_utf8() function shall retrieve the contents of a
19 BSON_TYPE_UTF8 element currently observed by iter.
20
21 It is invalid to call this function while observing an element other
22 than BSON_TYPE_UTF8.
23
25 A UTF-8 encoded string that has not been modified or freed.
26
27 It is suggested that the caller validate the content is valid UTF-8 be‐
28 fore using this in other places. That can be done by calling
29 bson_utf8_validate() or validating the underlying bson_t before iterat‐
30 ing it.
31
32 Note that not all drivers use multi-byte representation for \0 in UTF-8
33 encodings (commonly referred to as modified-UTF8). You probably want to
34 take a look at the length field when marshaling to other runtimes.
35
37 MongoDB, Inc
38
40 2017-present, MongoDB, Inc
41
42
43
44
451.25.1 Nov 08, 2023 BSON_ITER_UTF8(3)