Skip to content

Fix possible wrong EOL mode for UTF-8-BOM file#1054

Closed
dail8859 wants to merge 1 commit intonotepad-plus-plus:masterfrom
dail8859:utf_eol
Closed

Fix possible wrong EOL mode for UTF-8-BOM file#1054
dail8859 wants to merge 1 commit intonotepad-plus-plus:masterfrom
dail8859:utf_eol

Conversation

@dail8859
Copy link
Copy Markdown
Contributor

Closes #1002

@dail8859
Copy link
Copy Markdown
Contributor Author

The problem is if fread() is called multiple times, then UnicodeConvertor->convert() is called multiple times, which causes m_pNewBuf to point to the last read in chunk. Then after the entire file was loaded, getEOLFormatForm(UnicodeConvertor.getNewBuf(), ...) was being used which was only trying to detect the EOL mode from the last read in chunk. If this last chunk started with \n then the file was detected as Unix line endings. The file linked from issue #1002 happened to have just the right situation where this occurred.

I am not very familiar with different types of file encoding and never have to deal with them myself. I tried to test this as well as I could but by all means please thoroughly review this. Thanks :)

@donho donho closed this in 2fd963d Oct 27, 2015
@dail8859 dail8859 deleted the utf_eol branch November 1, 2015 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant