1BSON_UTF8(3) libbson BSON_UTF8(3)
2
3
4
6 bson_utf8 - UTF-8
7
9 Libbson expects that you are always working with UTF-8 encoded text.
10 Anything else is invalid API use.
11
12 If you should need to walk through UTF-8 sequences, you can use the
13 various UTF-8 helper functions distributed with Libbson.
14
16 To validate the string contained in my_string, use the following. You
17 may pass -1 for the string length if you know the string is NULL-termi‐
18 nated.
19
20 if (!bson_utf8_validate (my_string, -1, false)) {
21 printf ("Validation failed.\n");
22 }
23
24 If my_string has NULL bytes within the string, you must provide the
25 string length. Use the following format. Notice the true at the end in‐
26 dicating \0 is allowed.
27
28 if (!bson_utf8_validate (my_string, my_string_len, true)) {
29 printf ("Validation failed.\n");
30 }
31
32 For more information see the API reference for bson_utf8_validate().
33
35 MongoDB, Inc
36
38 2017-present, MongoDB, Inc
39
40
41
42
431.24.3 Aug 17, 2023 BSON_UTF8(3)