Utilities to validate and truncate UTF-8 encoded strings. More...
#include "oscl_base.h"
Go to the source code of this file.
Functions | |
OSCL_IMPORT_REF bool | oscl_str_is_valid_utf8 (const uint8 *str_buf, uint32 &num_valid_characters, uint32 max_bytes=0, uint32 max_char_2_valid=0, uint32 *num_byte_4_char=NULL) |
Check if the input string contains any illegal UTF-8 character. The function scans the string and validate that each character is a valid utf-8. It stops at the first NULL character, invalid character or the max_byte value. The string is valid if and only if every character is a valid utf-8 character and the scanning stopped on a character boundary. | |
OSCL_IMPORT_REF int32 | oscl_str_truncate_utf8 (uint8 *str_buf, uint32 max_char, uint32 max_bytes=0) |
Truncates the UTF-8 string upto the required size. |
Utilities to validate and truncate UTF-8 encoded strings.