#530 Bugfix for: EOL type not correctly determined for UTF-16 files

Next_release
closed
nobody
6.5 (1)
7
2013-11-10
2013-10-15
FLS
No

Bug Description:
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.

Bugfix:
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.

FLS

1 Attachments

Discussion

  • Don HO
    Don HO
    2013-11-01

    Hi FLS,

    It's committed in rev. 1143.
    Thank you for your patch.

    Don

     
  • Don HO
    Don HO
    2013-11-01

    • status: open --> accepted
    • Priority: 5 --> 7
     
  • Don HO
    Don HO
    2013-11-10

    • Status: accepted --> closed