When a UTF-16 (UCS-2) formatted text file is opened, Notepad++ (v6.5) does not determine the correct EOL format. It is always set to “Dos\Windows”, even if the “UNIX” or “Macintosh” format is present.
Reason of Bug:
When loading a file from disk, the conversion is done in FileManager::loadFileData(). There, the reading loop is continued with lenFile==0 (normally the last trial to read over the end of file. This causes the buffer UnicodeConvertor->m_pNewBuf to get invalid for UTF-16 cases.
Exactly that buffer is used in the calling function FileManager::loadFile() to determine the EOL format, which fails for UTF-16 and returns “Dos\Windows” as default value.
In FileManager::loadFileData() the conversion loop is not further executed (break-statement inserted) when lenFile==0.
- Commentcode: xUTF16EOLRecognition:
Furthermore, this should speed up the loading of files.