nux-1.14.0
|
ANSICHAR to UNICHAR conversion. More...
#include <NuxCore/Character/NUnicode.h>
Public Member Functions | |
UNICHAR * | Convert (const ANSICHAR *Source) |
ANSICHAR to UNICHAR conversion.
Definition at line 219 of file NUnicode.h.
UNICHAR * nux::AnsicharToUnicharConvertion::Convert | ( | const ANSICHAR * | Source | ) |
Convert from ANSICHAR to UNICHAR
Source | String to convert. Null terminated. |
Definition at line 55 of file NUnicode.cpp.
Referenced by nux::AnsiToTCharConversion::Convert(), and nux::TCharToUnicharConvertion::Convert().
{ std::string utf8string (Source); size_t utf8size = utf8string.length(); size_t utf16size = utf8size; UNICHAR *utf16string = new UNICHAR[utf16size+1]; const t_UTF8 *source_start = reinterpret_cast<const t_UTF8 *> (utf8string.c_str() ); const t_UTF8 *source_end = source_start + utf8size; t_UTF16 *target_start = reinterpret_cast<t_UTF16 *> (utf16string); t_UTF16 *target_end = target_start + utf16size; ConversionResult res = ConvertUTF8toUTF16 (&source_start, source_end, &target_start, target_end, lenientConversion); if (res != conversionOK) { delete[] utf16string; utf16string = 0; } // mark end of string *target_start = 0; return utf16string; }