UTF8 wrapper functions.
More...
#include "src/lib/mem.h"
#include "src/lib/utf8_wrapper.h"
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <ctype.h>
|
|
typedef int | utf8proc_option_t |
|
| static char * | normalize (const char *str, size_t len, size_t *newlen, utf8proc_option_t flags) |
| bool | utf8_wrap_validate (const char *str, size_t str_len) |
| char * | utf8_wrap_casefold (const char *str, size_t len, size_t *newlen) |
|
char * | utf8_wrap_normalize (const char *str, size_t len, size_t *newlen) |
| int | utf8_wrap_casecmp (const char *str1, size_t str1_len, const char *str2, size_t str2_len) |
|
|
static utf8proc_option_t | normalize_flags = 0 |
|
static utf8proc_option_t | casefold_flags = 0 |
◆ normalize()
| char * normalize |
( |
const char * | str, |
|
|
size_t | len, |
|
|
size_t * | newlen, |
|
|
utf8proc_option_t | flags ) |
|
static |
Normalizes a string
- Parameters
-
| str | String to normalize |
| len | String length |
| newlen | Pointer to size_t for the new string length |
| flags | Normalization flags |
- Returns
- Newly allocated char, caller must free it.
◆ utf8_wrap_casecmp()
| int utf8_wrap_casecmp |
( |
const char * | str1, |
|
|
size_t | str1_len, |
|
|
const char * | str2, |
|
|
size_t | str2_len ) |
Compares two strings case insensitive. Set's errno to EINVAL if one string is invalid utf8.
- Parameters
-
| str1 | String1 |
| str1_len | String1 length |
| str2 | String2 |
| str2_len | String2 length |
- Returns
- Same as strcasecmp
◆ utf8_wrap_casefold()
| char * utf8_wrap_casefold |
( |
const char * | str, |
|
|
size_t | len, |
|
|
size_t * | newlen ) |
Casefolds a string
- Parameters
-
| str | String to normalize |
| len | String length |
| newlen | Pointer to size_t for the new string length |
- Returns
- Newly allocated char, caller must free it.
◆ utf8_wrap_validate()
| bool utf8_wrap_validate |
( |
const char * | str, |
|
|
size_t | str_len ) |
Checks if string is valid utf8
- Parameters
-
| str | String to validate |
| str_len | String length |
- Returns
- true if string is valid, else false