Kate is inserting invisible characters at the start of text files.

I’ve recently been experiencing problems with Kate. It has started inserting invisible characters at the start of every file that it saves. The characters are (hex) EF BB BF. This happens simply by saving the file whether I actually edit it or not. KWrite does not do this, only Kate. I am running Kate 3.12.4 under KDE 4.12.4 in 64bit OpenSuse 13.1. I only recently noticed this in that shell scripts I’ve edited started to return command not found error messages. When I use Okteta to remove the extraneous characters, the scripts run fine. These are scripts that I originally created in Kate sometime in the past.

Is there some setting I don’t know about in Kate that may be doing this or is it a brand new bug?

Hm, I have never seen anything like this, and I cannot reproduce it right now either. (I too have KDE 4.12.4/Kate 3.12.4 installed)

But, (hex) EF BB BF is the “Byte Order Mark”: http://en.wikipedia.org/wiki/Byte_order_mark
So check the setting “Enable byte order marker” in “Configure Kate…”->“Editor Component”->Open/Save->General and disable it if activated.

Thanks, that was it. The BOM option was enabled. I didn’t enable it so it must have been made the default when, perhaps, it was added as an option to the editor.

No, it should be off by default. I just removed the kate config and started it again, and it was indeed off.

No idea, why it would have been enabled on your system, and I don’t know when this option was added.

But anyway, good to hear this has solved your problem. :slight_smile:

In KDE-4.5 according to http://kate-editor.org/2010/08/26/encoding-detection-revised/

Well, that’s about encoding detection (i.e. to find out whether a text file is encoded in UTF-8 or Latin-1 and so on), not about that BOM option.
But I think this does exist for quite some time already as well.