Fix 3 bytes file open issue
(Fixes #725) Open a file of 3 bytes length with '\0' in the middle, only 1 character shown in editor. Such file is detected as UTF16 w/o BOM, that makes the wrong length interpretation. Adding the "len mod 2 == 0" condition to enhance the detection is the only solution I can find so far.pull/1065/head
parent
fe62ff989b
commit
88e390fbc0
|
@ -205,7 +205,7 @@ void Utf8_16_Read::determineEncoding()
|
|||
m_nSkip = 3;
|
||||
}
|
||||
// try to detect UTF-16 little-endian without BOM
|
||||
else if (m_nLen > 1 && m_pBuf[0] != NULL && m_pBuf[1] == NULL && IsTextUnicode(m_pBuf, m_nLen, &uniTest))
|
||||
else if (m_nLen > 1 && m_nLen % 2 == 0 && m_pBuf[0] != NULL && m_pBuf[1] == NULL && IsTextUnicode(m_pBuf, m_nLen, &uniTest))
|
||||
{
|
||||
m_eEncoding = uni16LE_NoBOM;
|
||||
m_nSkip = 0;
|
||||
|
|
Loading…
Reference in New Issue