Bug 441854

Summary: Saved files are corrupted
Product: [Applications] kdevelop Reporter: Dr I J Ormshaw <ian_ormshaw>
Component: generalAssignee: kdevelop-bugs-null
Status: RESOLVED NOT A BUG    
Severity: normal CC: jpmbatrina01
Priority: NOR    
Version First Reported In: 5.6.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: KDevelop BOM Settings

Description Dr I J Ormshaw 2021-09-01 09:28:14 UTC
SUMMARY
When some text files are saved files are corrupted.  Three non printable octets are being inserted at the staer of the file.

STEPS TO REPRODUCE
1. add a file to a project e.g. test_in.awk
2. add source to the ouside of kdevelop e.g. echo "BEGIN {}" > test_in.awk
3 check the contents of the file: hexdump -C test_in.awk
00000000  42 45 47 49 4e 20 7b 7d  0a                       |BEGIN {}.|
4. open the file in kdevelop
5. delete the space between Gegin and {, then re-type it.
6. save the file
5. check the contents of the file again: hexdump -C test_in.awk
00000000  ef bb bf 42 45 47 49 4e  20 7b 7d 0a              |...BEGIN {}.|

OBSERVED RESULT
three octets are inserted at the begining of the file

EXPECTED RESULT
the two file dumps should be identical

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Fedora 43
(available in About System)
KDE Plasma Version:5.22.4-1.fc34
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
The problem seems to affect any test file of many different extantions e.g. .h.in, .bash ...
Comment 1 Jan Paul Batrina 2021-09-01 14:00:15 UTC
Created attachment 141220 [details]
KDevelop BOM Settings

Hello, thanks for the bug report!

`EF BB BF` is the UTF8 BOM (https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8). Make sure that Tools > Add Byte Order Mark (BOM) is unchecked (1st screenshot in image) and that Enable byte order mark (BOM) is disabled in the Editor open/save settings
Comment 2 Dr I J Ormshaw 2021-09-02 05:56:15 UTC
Thanks,the problem was that BOM was checked.  I have checked some .cpp/.h files I have edited and they also contain the BOM so gcc must cope with this, which is why it appeared only come file where being altered.