Bug 450225

Summary: DOS line endings are not correctly detected with files encoded in UTF-8 with BOM
Product: [Applications] kdiff3 Reporter: JaumeGreen
Component: applicationAssignee: michael <reeves.87>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 1.9.4   
Target Milestone: ---   
Platform: Microsoft Windows   
OS: Microsoft Windows   
Latest Commit: Version Fixed/Implemented In: 1.9.5
Sentry Crash Report:
Attachments: Attached sample files, one with the problematic encoding, second one with a encoding that works.

Description JaumeGreen 2022-02-14 15:00:56 UTC
Created attachment 146716 [details]
Attached sample files, one with the problematic encoding, second one with a encoding that works.

SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***
Similar to bug 442199, but with files encoded in UTF-8 with BOM.
It happens even if only one of them is like this.

STEPS TO REPRODUCE
1.  Have a couple of files encoded in UTF-8 with BOM, with CRLF as end of file.
2.  Compare them.

OBSERVED RESULT
Extra lines are shown. Application thinks that the line end style is Unix.

EXPECTED RESULT
No extra lines shown.

SOFTWARE/OS VERSIONS
Windows: Windows 10 Pro , build 19042.1526

ADDITIONAL INFORMATION
Comment 1 michael 2022-02-23 22:26:56 UTC
Git commit 4f14cfb9efd58e1ebe22e1d4e126b779018a21c0 by Michael Reeves.
Committed on 23/02/2022 at 21:32.
Pushed by mreeves into branch 'master'.

Fix EOL detection issues

Use QStream::read to read next character for EOL detection
Avoid QStream::pos due to severe speed issues
Related: bug 448353
FIXED-IN:1.9.5

M  +14   -12   src/SourceData.cpp
M  +87   -1    src/autotests/datareadtest.cpp

https://invent.kde.org/sdk/kdiff3/commit/4f14cfb9efd58e1ebe22e1d4e126b779018a21c0
Comment 2 michael 2022-02-23 22:28:04 UTC
Git commit ac247986d4d24bb28cfc112d58e3d0a808057b1a by Michael Reeves.
Committed on 23/02/2022 at 21:35.
Pushed by mreeves into tag '1.9.5'.

Fix EOL detection issues

Use QStream::read to read next character for EOL detection
Avoid QStream::pos due to severe speed issues
Related: bug 448353
FIXED-IN:1.9.5

M  +14   -11   src/SourceData.cpp

https://invent.kde.org/sdk/kdiff3/commit/ac247986d4d24bb28cfc112d58e3d0a808057b1a
Comment 3 michael 2022-02-23 22:37:13 UTC
Git commit 96cc89bec01f14bf5fc980e6ae250ffebbd7164f by Michael Reeves.
Committed on 23/02/2022 at 22:33.
Pushed by mreeves into branch '1.9'.

Fix EOL detection issues

Use QStream::read to read next character for EOL detection
Avoid QStream::pos due to severe speed issues
Related: bug 448353
FIXED-IN:1.9.5

M  +14   -11   src/SourceData.cpp

https://invent.kde.org/sdk/kdiff3/commit/96cc89bec01f14bf5fc980e6ae250ffebbd7164f