SYNOPSIS

#include <bson.h>

bool
bson_utf8_validate (const char *utf8,
                    size_t      utf8_len,
                    bool allow_null);

DESCRIPTION

The bson_utf8_validate() function shall check to see if the contents of utf8 is correct encoded UTF-8.

utf8_len should be the number of bytes in utf8 excluding the terminating \0 byte.

If allow_null is TRUE, then a \0 byte is allowed inside utf8. This is generally a bad idea, since it means utf8 can’t be used by strlen() and other libc functions.

RETURN VALUE

TRUE if utf8 is valid UTF-8. Otherwise FALSE.

ERRORS

No errors are defined.

AUTHORS

This page was written by MongoDB, Inc.