StringUtil: Use unicode replacement character in DecodeUTF8()
This commit is contained in:
parent
096a0811bf
commit
c8e61307b2
|
@ -388,7 +388,7 @@ size_t StringUtil::DecodeUTF8(const void* bytes, size_t length, char32_t* ch)
|
|||
}
|
||||
|
||||
invalid:
|
||||
*ch = 0xFFFFFFFFu;
|
||||
*ch = UNICODE_REPLACEMENT_CHARACTER; // unicode replacement character
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -263,6 +263,9 @@ void ReplaceAll(std::string* subject, const char search, const char replacement)
|
|||
/// Parses an assignment string (Key = Value) into its two components.
|
||||
bool ParseAssignmentString(const std::string_view str, std::string_view* key, std::string_view* value);
|
||||
|
||||
/// Unicode replacement character.
|
||||
static constexpr char32_t UNICODE_REPLACEMENT_CHARACTER = 0xFFFD;
|
||||
|
||||
/// Appends a UTF-16/UTF-32 codepoint to a UTF-8 string.
|
||||
void EncodeAndAppendUTF8(std::string& s, char32_t ch);
|
||||
|
||||
|
|
Loading…
Reference in New Issue