UTF-8

Encoding

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 (