squareball 0.2.0.28-7bb8 A general-purpose library for C99

- Main Page
- Data Structures
- Files
- Examples

- File List
- Globals

All Data Structures Files Functions Variables Typedefs
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

  str | The string.
  len | Length 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

  str | The string.
  len | Length 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

  str | The string object.

Returns
  A boolean `true` if the string is UTF-8 encoded.