Cbeam
Loading...
Searching...
No Matches
cbeam::encoding Namespace Reference

Focuses on UTF-8 checks, character handling, and encoding-specific validations. It includes lightweight helpers like is_valid_utf8 and has_utf8_specific_encoding, which verify the correctness and properties of strings under UTF-8 constraints. More...

Functions

bool is_valid_utf8 (const std::string &s)
 Returns if the given string conforms with UTF8 encoding.
 
bool has_utf8_specific_encoding (const std::string &s)
 Checks if the given string uses encoding that is specific to UTF-8.
 
 TEST (Encoding, IsValidUtf8OrHasUtf8SpecificEncoding)
 

Detailed Description

Focuses on UTF-8 checks, character handling, and encoding-specific validations. It includes lightweight helpers like is_valid_utf8 and has_utf8_specific_encoding, which verify the correctness and properties of strings under UTF-8 constraints.

Function Documentation

◆ has_utf8_specific_encoding()

bool cbeam::encoding::has_utf8_specific_encoding ( const std::string & s)
inline

Checks if the given string uses encoding that is specific to UTF-8.

This function returns true if the string contains characters encoded in a manner that is specific to UTF-8 and not part of the ASCII range (0-127). It helps to identify strings that are likely not extended ASCII (0-255), but rather UTF-8 encoded, based on the presence of multibyte characters that are conformant to the UTF-8 encoding rules.

Parameters
sthe string to check
Returns
true if the string uses UTF-8 specific encoding; false otherwise.

◆ is_valid_utf8()

bool cbeam::encoding::is_valid_utf8 ( const std::string & s)
inline

Returns if the given string conforms with UTF8 encoding.

◆ TEST()

cbeam::encoding::TEST ( Encoding ,
IsValidUtf8OrHasUtf8SpecificEncoding  )