---
name: "bson_utf8_validate"
section: "3"
platform: "linux"
package: "libbson-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/bson_utf8_validate"
---

# bson\_utf8\_validate(3)

## SYNOPSIS

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

## PARAMETERS

- •

  **utf8**: A string to verify.

- •

  **utf8\_len**: The length of **utf8** in bytes.

- •

  **allow\_null**: A bool indicating that embedded **\\0** bytes are allowed.

## DESCRIPTION

Validates that the content within **utf8** is valid UTF-8 (by the RFC 3629 standard). If **allow\_null** is **true**, then embedded NULL bytes are allowed (**\\0**).

## RETURNS

true if **utf8** contains valid UTF-8.

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
