13 #ifndef _FCITX_UTILS_CUTF8_H_ 14 #define _FCITX_UTILS_CUTF8_H_ 18 #include <fcitx-utils/fcitxutils_export.h> 21 #define FCITX_UTF8_MAX_LENGTH 6 FCITXUTILS_EXPORT void fcitx_utf8_strncpy(char *str, const char *s, size_t byte)
Copy most byte length, but keep utf8 valid.
FCITXUTILS_EXPORT char * fcitx_utf8_get_nth_char(const char *s, uint32_t n)
Get the pointer to the nth character.
FCITXUTILS_EXPORT uint32_t fcitx_utf8_get_char_validated(const char *p, int max_len, int *plen)
Get validated character.
FCITXUTILS_EXPORT size_t fcitx_utf8_strlen(const char *s)
Get utf8 string length.
FCITXUTILS_EXPORT unsigned int fcitx_utf8_char_len(const char *in)
Get the number of bytes of next character.
FCITXUTILS_EXPORT size_t fcitx_utf8_strnlen_validated(const char *str, size_t byte)
Count most byte length, utf8 string length and validates the string.
FCITXUTILS_EXPORT size_t fcitx_utf8_strnlen(const char *str, size_t byte)
Count most byte length, utf8 string length.
FCITXUTILS_EXPORT int fcitx_ucs4_to_utf8(uint32_t c, char *output)
Convert ucs4 char to utf8, need to have enough memory for it.
FCITXUTILS_EXPORT int fcitx_ucs4_char_len(uint32_t c)
Return the utf8 bytes of a UCS4 char.
FCITXUTILS_EXPORT char * fcitx_utf8_get_char(const char *in, uint32_t *chr)
Get UCS-4 char in the utf8 string.
FCITXUTILS_EXPORT bool fcitx_utf8_check_string(const char *s)
Check if the string is valid utf8 string.