mirror of
https://github.com/reactos/reactos.git
synced 2024-06-28 17:01:28 +00:00
There was a bug in encoding analyzer. CORE-14641
This commit is contained in:
parent
7014f63057
commit
d3da0cb7ed
|
@ -39,7 +39,7 @@ BOOL IsTextNonZeroASCII(const void *pText, DWORD dwSize)
|
||||||
|
|
||||||
ENCODING AnalyzeEncoding(const char *pBytes, DWORD dwSize)
|
ENCODING AnalyzeEncoding(const char *pBytes, DWORD dwSize)
|
||||||
{
|
{
|
||||||
INT flags = IS_TEXT_UNICODE_STATISTICS | IS_TEXT_UNICODE_REVERSE_STATISTICS;
|
INT flags = IS_TEXT_UNICODE_STATISTICS;
|
||||||
|
|
||||||
if (dwSize <= 1 || IsTextNonZeroASCII(pBytes, dwSize))
|
if (dwSize <= 1 || IsTextNonZeroASCII(pBytes, dwSize))
|
||||||
return ENCODING_ANSI;
|
return ENCODING_ANSI;
|
||||||
|
@ -47,7 +47,9 @@ ENCODING AnalyzeEncoding(const char *pBytes, DWORD dwSize)
|
||||||
if (IsTextUnicode(pBytes, dwSize, &flags))
|
if (IsTextUnicode(pBytes, dwSize, &flags))
|
||||||
return ENCODING_UTF16LE;
|
return ENCODING_UTF16LE;
|
||||||
|
|
||||||
if ((flags & IS_TEXT_UNICODE_REVERSE_MASK) && !(flags & IS_TEXT_UNICODE_ILLEGAL_CHARS))
|
flags = IS_TEXT_UNICODE_STATISTICS | IS_TEXT_UNICODE_REVERSE_STATISTICS;
|
||||||
|
IsTextUnicode(pBytes, dwSize, &flags);
|
||||||
|
if (((flags & IS_TEXT_UNICODE_REVERSE_MASK) == IS_TEXT_UNICODE_REVERSE_STATISTICS))
|
||||||
return ENCODING_UTF16BE;
|
return ENCODING_UTF16BE;
|
||||||
|
|
||||||
/* is it UTF-8? */
|
/* is it UTF-8? */
|
||||||
|
|
Loading…
Reference in a new issue