MQTT C Client Libraries Internals
|
Functions for checking that strings contain UTF-8 characters only. More...
#include "utf-8.h"
#include <stdlib.h>
#include <string.h>
#include "StackTrace.h"
Macros | |
#define | ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) |
Macro to determine the number of elements in a single-dimension array. | |
Functions | |
static const char * | UTF8_char_validate (int len, const char *data) |
Validate a single UTF-8 character. More... | |
int | UTF8_validate (int len, const char *data) |
Validate a length-delimited string has only UTF-8 characters. More... | |
int | UTF8_validateString (const char *string) |
Validate a null-terminated string has only UTF-8 characters. More... | |
Variables | |
struct { | |
int len | |
number of elements in the following array (1 to 4) | |
struct { | |
char lower | |
lower limit of valid range | |
char upper | |
upper limit of valid range | |
} bytes [4] | |
up to 4 bytes can be used per character | |
} | valid_ranges [] |
Structure to hold the valid ranges of UTF-8 characters, for each byte up to 4. More... | |
Functions for checking that strings contain UTF-8 characters only.
See page 104 of the Unicode Standard 5.0 for the list of well formed UTF-8 byte sequences.
|
static |
Validate a single UTF-8 character.
len | the length of the string in "data" |
data | the bytes to check for a valid UTF-8 char |
int UTF8_validate | ( | int | len, |
const char * | data | ||
) |
Validate a length-delimited string has only UTF-8 characters.
len | the length of the string in "data" |
data | the bytes to check for valid UTF-8 characters |
int UTF8_validateString | ( | const char * | string | ) |
Validate a null-terminated string has only UTF-8 characters.
string | the string to check for valid UTF-8 characters |
struct { ... } valid_ranges[] |
Structure to hold the valid ranges of UTF-8 characters, for each byte up to 4.