Bug 437219 - utf8 bom problem
Summary: utf8 bom problem
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: 21.04.1
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-16 21:58 UTC by Evren
Modified: 2022-09-03 12:50 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Evren 2021-05-16 21:58:07 UTC
SUMMARY
When i edit and save a file that was ASCII, for example windows batch file or CMakeLists.txt file, kate save it as UTF-8 with BOM, not ASCII, then for example, cmake is sensitive to being ASCII only, it give errors when it sees UTF-8 BOM in the file, that's how i noticed this behavior of kate, batch files also give error on the first line of the file becaues of this.
There is a temporary workaround for this problem, every time i open ASCII file, i had to uncheck "Add Byte Order Mark" from the "Tools" menu, if i forget to uncheck, i have no idea which files i broke before they give errors.
Kate also needs ASCII encoding in top of the Encodings list, so to be not confused with UTF-8 or not.

STEPS TO REPRODUCE
1. Open an ASCII file
2. Edit
3. Save

OBSERVED RESULT
File is saved with UTF-8 BOM

EXPECTED RESULT
File should be saved with same encoding as it was previously, at least if BOM is not present before opening the file, it should not be present after saving too

SOFTWARE/OS VERSIONS
Windows: 10 20H2
Comment 1 Christoph Cullmann 2022-06-16 18:52:45 UTC
Hmm, have you enabled the "Add Byte Order Mark" in the configuration dialog?

Plain ASCII and UTF-8 are impossible to determine on loading, if all stays in the 0..127 range.

I would just deactivate that setting globally.
Comment 2 Waqar Ahmed 2022-08-25 19:57:49 UTC
marking as WAITINGFORINFO
Comment 3 Evren 2022-09-03 12:50:08 UTC
i confirm bug is not found in current version of kate on windows and linux both, so i think its fixed