Added a wrapper for U16toU8, called AUTOU16TOU8

- U16toU8 now requires a max arument to be passed
This commit is contained in:
2021-03-17 23:41:47 -05:00
parent 610a683804
commit 574f0cab09
9 changed files with 43 additions and 38 deletions

View File

@@ -148,7 +148,8 @@ int main() {
// helper functions
std::string U16toU8(char16_t* src) {
std::string U16toU8(char16_t* src, size_t max) {
src[max-1] = '\0'; // force a NULL terminatorstd::string U16toU8(char16_t* src) {
try {
std::wstring_convert<std::codecvt_utf8_utf16<char16_t>,char16_t> convert;
return convert.to_bytes(src);