MSVC fails to deduce character type from std::string/wstring when
converting to std::basic_string_view.
Reference: f5bce32d06cdcf677ce8080027d3317c6387e715
Signed-off-by: Simon Rozman <simon@rozman.si>
This parameter is needed to provide compatibility between utf16_t and
utf32_t, so we may call this function from a single template for both
types.
Signed-off-by: Simon Rozman <simon@rozman.si>
Windows and Apple (NSString) are using UTF-16 wchar_t. All others use
UTF-32. This eliminates need for additional conversion should we need
UTF-32 on Windows&Apple or UTF-16 on others. Mind, UTF-16↔32 is not a
trivial conversion as it may change number of code units.
Signed-off-by: Simon Rozman <simon@rozman.si>
Since stdex::locale_default is inline, it is initialized by the first
module referencing it. Not necessarily compiled with the same _CONSOLE
definition as other modules. This makes the default locale fluid.
Signed-off-by: Simon Rozman <simon@rozman.si>
Brain-dead _Printf_format_string_ SAL doesn't understand utf32_t is good
enough for unsigned int expected by %x placeholder.
Signed-off-by: Simon Rozman <simon@rozman.si>
Each unit test .cpp file is not a separate compilation unit in Xcode project
like it is in Visual Studio. Hopefully, Visual Studio test tool still likes
this arrangement.
Signed-off-by: Simon Rozman <simon@rozman.si>
vsnprintf_l and vswprintf_l mutate va_list parameter on some versions of macOS (11.7 Big Sur).
This makes it impossible to call printf multiple times with a growing buffer.
Signed-off-by: Simon Rozman <simon@rozman.si>
Actually, using ill-created locale was the cause sprintf returned EILSEQ on %ls inserts containing emoji.
Signed-off-by: Simon Rozman <simon@rozman.si>
This allows same platform management across different operating systems.
Like with charset_id, the Windows numbering was adopted.
Signed-off-by: Simon Rozman <simon@rozman.si>
Microsoft declares all identifiers starting with underscore _ as
internal to MSVC. Thus, we should either use defined(DEBUG) or
!defined(NDEBUG) to distinguish Debug and Release builds.
Signed-off-by: Simon Rozman <simon@rozman.si>
While being here only for templates to work with various data types, the
one-byte "swap" functions are actually noop.
Signed-off-by: Simon Rozman <simon@rozman.si>