.\" This manpage is Copyright (C) 2016 MongoDB, Inc. .\" .\" Permission is granted to copy, distribute and/or modify this document .\" under the terms of the GNU Free Documentation License, Version 1.3 .\" or any later version published by the Free Software Foundation; .\" with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. .\" A copy of the license is included in the section entitled "GNU .\" Free Documentation License". .\" .TH "UTF\(hy8" "3" "2016\(hy10\(hy12" "libbson" .SH NAME UTF-8 \- None .SH "ENCODING" Libbson expects that you are always working with UTF\(hy8 encoded text. Anything else is INVALID API USE. If you should need to walk through UTF\(hy8 sequences, you can use the various UTF\(hy8 helper functions distributed with Libbson. .SH "VALIDATING A UTF-8 SEQUENCE" To validate the string contained in .B my_string , use the following. You may pass .B -1 for the string length if you know the string is NULL\(hyterminated. .nf .nf if (!bson_utf8_validate (my_string, \(hy1, false)) { printf ("Validation failed.\en"); } .fi .fi If .B my_string has NULL bytes within the string, you must provide the string length. Use the follwing format. Notice the .B true at the end indicationg .B \0 is allowed. .nf .nf if (!bson_utf8_validate (my_string, my_string_len, true)) { printf ("Validation failed.\en"); } .fi .fi For more information see the API reference for .B bson_utf8_validate(3) . .B .SH COLOPHON This page is part of libbson. Please report any bugs at https://jira.mongodb.org/browse/CDRIVER.