libguac
1.0.0
|
Provides functions for manipulating Unicode strings. More...
Go to the source code of this file.
Functions | |
size_t | guac_utf8_charsize (unsigned char c) |
Given the initial byte of a single UTF-8 character, returns the overall byte size of the entire character. More... | |
size_t | guac_utf8_strlen (const char *str) |
Given a UTF-8-encoded string, returns the length of the string in characters (not bytes). More... | |
int | guac_utf8_write (int codepoint, char *utf8, int length) |
Given destination buffer and its length, writes the given codepoint as UTF-8 to the buffer, returning the number of bytes written. More... | |
int | guac_utf8_read (const char *utf8, int length, int *codepoint) |
Given a buffer containing UTF-8 characters, reads the first codepoint in the buffer, returning the length of the codepoint in bytes. More... | |
Provides functions for manipulating Unicode strings.
size_t guac_utf8_charsize | ( | unsigned char | c | ) |
Given the initial byte of a single UTF-8 character, returns the overall byte size of the entire character.
c | The initial byte of the character to check. |
int guac_utf8_read | ( | const char * | utf8, |
int | length, | ||
int * | codepoint | ||
) |
Given a buffer containing UTF-8 characters, reads the first codepoint in the buffer, returning the length of the codepoint in bytes.
If no codepoint could be read, zero is returned.
utf8 | A buffer containing UTF-8 characters. |
length | The length of the buffer, in bytes. |
codepoint | A pointer to an integer which will contain the codepoint read, if any. If no character can be read, the integer will be left untouched. |
size_t guac_utf8_strlen | ( | const char * | str | ) |
Given a UTF-8-encoded string, returns the length of the string in characters (not bytes).
str | The UTF-8 string to calculate the length of. |
int guac_utf8_write | ( | int | codepoint, |
char * | utf8, | ||
int | length | ||
) |
Given destination buffer and its length, writes the given codepoint as UTF-8 to the buffer, returning the number of bytes written.
If there is not enough space in the buffer to write the character, no bytes are written at all.
codepoint | The Unicode codepoint to write to the buffer. |
utf8 | The buffer to write to. |
length | The length of the buffer, in bytes. |