mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 13:55:38 +00:00
StringUtil: Use unicode replacement character in DecodeUTF8()
This commit is contained in:
parent
b7a2b0b265
commit
3ed3b5a076
|
@ -388,7 +388,7 @@ size_t StringUtil::DecodeUTF8(const void* bytes, size_t length, char32_t* ch)
|
||||||
}
|
}
|
||||||
|
|
||||||
invalid:
|
invalid:
|
||||||
*ch = 0xFFFFFFFFu;
|
*ch = UNICODE_REPLACEMENT_CHARACTER; // unicode replacement character
|
||||||
return 1;
|
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.
|
/// 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);
|
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.
|
/// Appends a UTF-16/UTF-32 codepoint to a UTF-8 string.
|
||||||
void EncodeAndAppendUTF8(std::string& s, char32_t ch);
|
void EncodeAndAppendUTF8(std::string& s, char32_t ch);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue