squareball  0.2.0.51-89d5
A general-purpose library for C99
sb-utf8.h File Reference

UTF-8 utilities. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "sb-string.h"

Go to the source code of this file.

Functions

bool sb_utf8_validate (const uint8_t *str, size_t len)
 
bool sb_utf8_validate_str (sb_string_t *str)
 
size_t sb_utf8_bom_length (const uint8_t *str, size_t len)
 

Detailed Description

UTF-8 utilities.

Function Documentation

size_t sb_utf8_bom_length ( const uint8_t *  str,
size_t  len 
)

Function that returns the length of the UTF-8 BOM, if found in the string.

Parameters
strThe string.
lenLength of str.
Returns
The length of the UTF-8 BOM, or 0.
bool sb_utf8_validate ( const uint8_t *  str,
size_t  len 
)

Function that checks if a string is UTF-8 encoded.

Parameters
strThe string.
lenLength of str.
Returns
A boolean true if the string is UTF-8 encoded.
bool sb_utf8_validate_str ( sb_string_t str)

Function that checks if a string object's content is UTF-8 encoded.

Parameters
strThe string object.
Returns
A boolean true if the string is UTF-8 encoded.