Lots of work on unicode support

This commit is contained in:
2023-05-19 00:23:23 -04:00
parent a25213d259
commit 7e25be10a4
10 changed files with 249 additions and 228 deletions

View File

@@ -46,6 +46,23 @@ std::string package_lua_source(const std::filesystem::path &base, std::ostream *
//
void split_target(std::string_view target, std::string &cert, std::string &host, std::string &port);
// Return true if the unicode codepoint can be converted to a single 16-bit wchar_t.
//
bool is_single_wchar_t(char32_t c);
// Convert a codepoint string into a UTF8-string.
// If the codepoint string contains invalid codepoints, they're silently dropped.
//
std::string to_utf8(const std::u32string &cps);
// Convert a UTF8 string to a codepoint 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
// utf-8 sequence. Returns the Codepoint string and the number of bytes consumed.
//
std::u32string from_utf8(std::string_view source, int *consumed);
// Get a system error message, in an OS-independent manner.
//
// These versions of strerror is thread-safe, and it never fails