string: add variants for char16_t/char32_t strings
char16_t is not exactly the wchar_t on Windows. char32_t is not exactly the wchar_t on POSIX. Rather than selecting the appropriate variant, polymorphism picked the template implementation of strncmp, strcpy and strncpy. The one that does not convert UTF16 surrogate pairs against their UTF32 representation. Signed-off-by: Simon Rozman <simon@rozman.si>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
SPDX-License-Identifier: MIT
|
||||
Copyright © 2023-2025 Amebis
|
||||
*/
|
||||
@@ -16,7 +16,7 @@ namespace UnitTests
|
||||
{
|
||||
stdex::utf32_t tmp[0x100];
|
||||
stdex::strncpy(tmp, u"This is a 🐔Test🐮.");
|
||||
Assert::AreEqual(reinterpret_cast<const stdex::utf32_t*>(U"This is a 🐔Test🐮."), tmp);
|
||||
Assert::IsTrue(stdex::strcmp(U"This is a 🐔Test🐮.", tmp) == 0);
|
||||
}
|
||||
|
||||
void string::sprintf()
|
||||
|
Reference in New Issue
Block a user