3 @brief Unicode Transformation Format
6 | U+0000000 ~ U+0000007F | 0XXXXXXX |
7 | U+0000080 ~ U+000007FF | 110XXXXX 10XXXXXX |
8 | U+0000800 ~ U+0000FFFF | 1110XXXX 10XXXXXX 10XXXXXX |
9 | U+0010000 ~ U+001FFFFF | 11110XXX 10XXXXXX 10XXXXXX 10XXXXXX |
10 | U+0200000 ~ U+03FFFFFF | 111110XX 10XXXXXX 10XXXXXX 10XXXXXX 10XXXXXX |
11 | U+4000000 ~ U+7FFFFFFF | 1111110X 10XXXXXX 10XXXXXX 10XXXXXX 10XXXXXX 10XXXXXX |
21 @addtogroup A_UTF Unicode Transformation Format
25 #if defined(__cplusplus)
27 #endif /* __cplusplus */
30 @brief encode one unicode code point into UTF-8
31 @param[in] str a buffer to store a UTF-8 character
32 @param[in] val the unicode value to be encoded
33 @return offset to the next character
35 A_EXTERN
unsigned int a_utf_encode(void *str
, a_u32 val
);
38 @brief decode one unicode code point from UTF-8
39 @param[in] str string terminated with a null character
40 @param[in,out] val a pointer to a variable that stores unicode
41 @return offset to the next character
42 @retval 0 null character or invalid
44 A_EXTERN
unsigned int a_utf_decode(void const *str
, a_u32
*val
);
47 @brief length of a UTF-8 string terminated with a null character
48 @param[in] str string terminated with a null character
49 @return length of the UTF-8 string
51 A_EXTERN a_size
a_utf_length(void const *str
);
52 #define a_utf_len(str) a_utf_length(str)
54 #if defined(__cplusplus)
56 #endif /* __cplusplus */