mirror of
https://github.com/reactos/reactos.git
synced 2024-11-25 12:33:34 +08:00
parent
1f80221ce5
commit
142d16c8a0
@ -48,6 +48,19 @@ static BOOL Append(LPWSTR *ppszText, DWORD *pdwTextLen, LPCWSTR pszAppendText, D
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL IsTextNonZeroASCII(const void *pText, DWORD dwSize)
|
||||
{
|
||||
const signed char *pBytes = pText;
|
||||
while (dwSize-- > 0)
|
||||
{
|
||||
if (*pBytes <= 0)
|
||||
return FALSE;
|
||||
|
||||
++pBytes;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
ENCODING AnalyzeEncoding(const char *pBytes, DWORD dwSize)
|
||||
{
|
||||
INT flags = IS_TEXT_UNICODE_STATISTICS;
|
||||
@ -55,6 +68,11 @@ ENCODING AnalyzeEncoding(const char *pBytes, DWORD dwSize)
|
||||
if (dwSize <= 1)
|
||||
return ENCODING_ANSI;
|
||||
|
||||
if (IsTextNonZeroASCII(pBytes, dwSize))
|
||||
{
|
||||
return ENCODING_ANSI;
|
||||
}
|
||||
|
||||
if (IsTextUnicode(pBytes, dwSize, &flags))
|
||||
{
|
||||
return ENCODING_UTF16LE;
|
||||
|
Loading…
Reference in New Issue
Block a user