mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-15 03:28:11 +08:00
Correct coding to Utf16
This commit is contained in:
@ -283,7 +283,7 @@ namespace NSStringExt
|
||||
|
||||
return pUnicodes;
|
||||
}
|
||||
unsigned short* CConverter::GetUtf16FromUnicode(const std::wstring& wsUnicodeText, unsigned int& unLen)
|
||||
unsigned short* CConverter::GetUtf16FromUnicode(const std::wstring& wsUnicodeText, unsigned int& unLen, const bool& bIsLE)
|
||||
{
|
||||
unsigned int unTextLen = (unsigned int)wsUnicodeText.size();
|
||||
if (unTextLen <= 0)
|
||||
@ -338,6 +338,18 @@ namespace NSStringExt
|
||||
}
|
||||
}
|
||||
|
||||
if (!bIsLE)
|
||||
{
|
||||
unsigned char* pDataReverce = (unsigned char*)pUtf16;
|
||||
unsigned int unLen2 = unLen << 1;
|
||||
for (unsigned int i = 0; i < unLen2; i += 2)
|
||||
{
|
||||
unsigned char tmp = pDataReverce[i];
|
||||
pDataReverce[i] = pDataReverce[i + 1];
|
||||
pDataReverce[i + 1] = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
return pUtf16;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user