table of contents
UTF‐8(3) | Library Functions Manual | UTF‐8(3) |
NAME¶
UTF-8 - NoneENCODING¶
Libbson expects that you are always working with UTF‐8 encoded text. Anything else is INVALID API USE.If you should need to walk through UTF‐8 sequences, you can use the various UTF‐8 helper functions distributed with Libbson.
VALIDATING A UTF-8 SEQUENCE¶
To validate the string contained in my_string , use the following. You may pass -1 for the string length if you know the string is NULL‐terminated.
if (!bson_utf8_validate (my_string, ‐1, false)) { printf ("Validation failed.\n"); }
If my_string has NULL bytes within the string, you must provide the string length. Use the follwing format. Notice the true at the end indicationg is allowed.
if (!bson_utf8_validate (my_string, my_string_len, true)) { printf ("Validation failed.\n"); }
For more information see the API reference for bson_utf8_validate(3)
COLOPHON¶
This page is part of libbson. Please report any bugs at https://jira.mongodb.org/browse/CDRIVER.2016‐10‐12 | libbson |