More UTF-16 stuff

This commit is contained in:
2023-06-01 20:25:24 -04:00
parent b98bf33724
commit e7e68a071d
2 changed files with 47 additions and 1 deletions

View File

@@ -55,7 +55,7 @@ bool is_single_wchar_t(char32_t c);
//
std::string utf32_to_utf8(const std::u32string &cps);
// Convert a UTF8 string to a codepoint string.
// Convert a UTF8 string to a UTF32 string.
//
// If the UTF8 string contains invalid sequences, they're silently dropped.
// Some of the bytes may not be consumed, if the source ends with an unfinished
@@ -73,6 +73,12 @@ std::u32string utf8_to_utf32(std::string_view source, int *consumed);
//
std::u16string utf8_to_ucs2(std::string_view source, int *consumed);
// Convert a UTF16 string to a UTF8 string.
//
// If the UTF16 string contains invalid sequences, they're silently dropped.
//
std::string utf16_to_utf8(std::u16string_view source);
// Get a system error message, in an OS-independent manner.
//
// These versions of strerror is thread-safe, and it never fails