Bug 441854 - Saved files are corrupted
Summary: Saved files are corrupted
Status: RESOLVED NOT A BUG
Alias: None
Product: kdevelop
Classification: Applications
Component: general (other bugs)
Version First Reported In: 5.6.2
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-01 09:28 UTC by Dr I J Ormshaw
Modified: 2021-09-02 05:56 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
KDevelop BOM Settings (134.49 KB, image/png)
2021-09-01 14:00 UTC, Jan Paul Batrina
Details

Note You need to log in before you can comment on or make changes to this bug.
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.