1 /* $NetBSD: utf8.h,v 1.1 2024/02/18 20:57:54 christos Exp $ */ 2 3 /* 4 * Copyright (C) Internet Systems Consortium, Inc. ("ISC") 5 * 6 * SPDX-License-Identifier: MPL-2.0 7 * 8 * This Source Code Form is subject to the terms of the Mozilla Public 9 * License, v. 2.0. If a copy of the MPL was not distributed with this 10 * file, you can obtain one at https://mozilla.org/MPL/2.0/. 11 * 12 * See the COPYRIGHT file distributed with this work for additional 13 * information regarding copyright ownership. 14 */ 15 16 /*! \file isc/utf8.h */ 17 18 #pragma once 19 20 #include <isc/lang.h> 21 #include <isc/types.h> 22 23 ISC_LANG_BEGINDECLS 24 25 bool 26 isc_utf8_bom(const unsigned char *buf, size_t len); 27 /*< 28 * Returns 'true' if the string of bytes in 'buf' starts 29 * with an UTF-8 Byte Order Mark. 30 * 31 * Requires: 32 *\li 'buf' != NULL 33 */ 34 35 bool 36 isc_utf8_valid(const unsigned char *buf, size_t len); 37 /*< 38 * Returns 'true' if the string of bytes in 'buf' is a valid UTF-8 39 * byte sequence otherwise 'false' is returned. 40 * 41 * Requires: 42 *\li 'buf' != NULL 43 */ 44 45 ISC_LANG_ENDDECLS 46