Setting encoding in Kate

Nikos Chantziaras realnc at
Wed Sep 6 14:16:16 BST 2017

On 06/09/17 15:53, Kevin Krammer wrote:
> On Monday, 2017-09-04, 22:46:44, Nikos Chantziaras wrote:
>> Is there a way to mark a file as using a specific encoding? Like some
>> string inside a C comment that Kate recognizes?
> I think Kate does understand comments like this, I vaguely remember seeing
> some for giving hints on intentation.
> So I've checked my KDE source and found this
> // kate: encoding utf-8
> and
> /* kate: encoding utf-8 */

It's recognized, but doesn't work. If I set:

   /* kate: encoding cp 1252 */

on the first line of the file, then "Tools->Encoding" actually reflects 
that, but the file is not shown correctly. It still shows solid blocks 
for CP1252 characters.

Even worse, if I have that comment in the file and try to switch the 
encoding manually (from and to CP1252), then Kate corrupts the file by 
deleting the unrecognized "block" characters.

More information about the kde mailing list