le_utf8.h
Go to the documentation of this file.
8 * This module implements safe and easy to use string handling functions for null-terminated strings12 * character set. UTF-8 has become the dominant character encoding because it is self synchronizing,28 * Single byte codes are used only for the ASCII values 0 through 127. In this case, UTF-8 has the32 * Character codes larger than 127 have a multi-byte encoding consisting of a leading byte and one68 * Even though we have not filled the destination buffer,we have truncated the copied string. Essentially, functions like71 * For le_utf8_Copy(), the number of bytes actually copied is returned in the numBytesPtr parameter.72 * This parameter can be set to NULL if the number of bytes copied is not needed. le_utf8_Append()97 * @c le_utf8_NumChars() is useful for counting the number of characters in a string (ie. for display102 * The function le_utf8_NumBytesInChar() can be used to determine the number of bytes in a character104 * When the first byte is read, it can be passed to le_utf8_NumBytesInChar() to determine how many110 * byte sequence. The @c le_utf8_IsFormatCorrect() function can be used to check if a string conforms126 //--------------------------------------------------------------------------------------------------139 //--------------------------------------------------------------------------------------------------143 * UTF-8 encoded characters may be larger than 1 byte so the number of characters is not necessarily150 //--------------------------------------------------------------------------------------------------157 //--------------------------------------------------------------------------------------------------164 //--------------------------------------------------------------------------------------------------171 //--------------------------------------------------------------------------------------------------178 //--------------------------------------------------------------------------------------------------185 //--------------------------------------------------------------------------------------------------192 //--------------------------------------------------------------------------------------------------194 (202 //--------------------------------------------------------------------------------------------------205 * copied (not including the NULL-terminator) in numBytesPtr. Null can be passed into numBytesPtr208 * If the size of srcStr is less than or equal to the destination buffer size then the entire srcStr209 * will be copied including the null-character. The rest of the destination buffer is not modified.211 * If the size of srcStr is larger than the destination buffer then the maximum number of characters214 * UTF-8 characters may be more than one byte long and this function will only copy whole characters216 * copied characters may not fill the entire destination buffer because the last character copied227 //--------------------------------------------------------------------------------------------------239 //--------------------------------------------------------------------------------------------------242 * The srcStr must be in UTF-8 format. The number of bytes in the resultant destStr (not including248 * This function will copy as many characters as possible from srcStr to destStr while ensuring that251 * UTF-8 characters may be more than one byte long and this function will only copy whole characters262 //--------------------------------------------------------------------------------------------------274 //--------------------------------------------------------------------------------------------------290 //--------------------------------------------------------------------------------------------------303 //--------------------------------------------------------------------------------------------------311 //--------------------------------------------------------------------------------------------------318 //--------------------------------------------------------------------------------------------------327 //--------------------------------------------------------------------------------------------------size_t le_utf8_NumBytesInChar(const char firstByte)ssize_t le_utf8_NumChars(const char *string)bool le_utf8_IsFormatCorrect(const char *string)le_result_t le_utf8_Copy(char *destStr, const char *srcStr, const size_t destSize, size_t *numBytesPtr)le_result_t le_utf8_Append(char *destStr, const char *srcStr, const size_t destSize, size_t *destStrLenPtr)le_result_t le_utf8_ParseInt(int *valuePtr, const char *arg)static bool le_utf8_IsContinuationByte(const char byte)Definition: le_utf8.h:194size_t le_utf8_NumBytes(const char *string)le_result_t le_utf8_CopyUpToSubStr(char *destStr, const char *srcStr, const char *subStr, const size_t destSize, size_t *numBytesPtr)