Bug 159135

Summary: kate ignores encoding in Modes (former filetypes)
Product: [Applications] kate Reporter: janow49420
Component: encodingAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: axel.carl.mueller, bluedzins, cullmann
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: test.THEFILEEXTENSION

Description janow49420 2008-03-11 13:30:25 UTC
Version:           4.0.2 (using KDE 4.0.2)
Installed from:    Gentoo Packages

If you set a rule for an encoding to open in a particular file with a particular extension:

~/.kde4.0/share/config/katemoderc

for example it makes an entry:

[Other/MY_RULE]
Highlighting=None
Highlighting Generated=false
Highlighting Version=
Mimetypes=
Priority=0
Section=
Variables=kate: encoding ibm866
Wildcards=*.THEEXTENSION

This should open any file ending with .THEEXTENSION in ibm866.

Kwrite seems to ignore this and open it in UTF-8 anyway, obviously not displaying the characters correctly.

It will however show that ibm866 is selected in the menu if you got to check the encoding.
Comment 1 janow49420 2008-03-11 13:42:38 UTC
Created attachment 23865 [details]
test.THEFILEEXTENSION

Important, if the files open with ? in black circles, it's being opened in
UTF-8 and not ibm866.

gunzip the file before opening it.
Comment 2 janow49420 2008-03-11 13:45:21 UTC
Also note in the config above i used .THEEXTENSION and in the actual file i used .THEFILEEXTENSION you can make it anything you like.
Comment 3 janow49420 2008-03-11 13:56:38 UTC
Also for some reason the file i uploaded test.THEFILEEXTENSION.gz seems to be called attachment.cgi when you download it from this bug. Simply rename it to test.THEFILEEXTENSION.gz  when it's on your desktop. I gzipped it to preserve it's encoding.
Comment 4 Anne-Marie Mahfouf 2008-03-11 14:18:49 UTC
Confirmed, I tried it with KWrite 3.5 and it works (config is saved in katefiletyperc and correctly read and set) while in KWrite 4, config is correctly written in katemoderc, the encoding is set in the Encoding menu (Tools -> Encoding) but the file opens as UTF-8.
Comment 5 janow49420 2008-03-11 16:36:29 UTC
"but the file opens as UTF-8."

But it has a tick next to IBM866, so it looks like it's reading the config but just ignoring it anyway.
Comment 6 Franklin Weng 2008-06-15 10:44:36 UTC
1. Bug 161777 seems to be a duplication of this one.
2. In my own environment, not only kwrite or kate has this problem, even konqueror has the same problem in KDE4.  When I used konqueror to open a (local) web page, I can not change the viewing encoding either.

My environment: KDE 4.0.4 installed from Mandriva 2008.1 backports.
locale: zh_TW.UTF-8.
Comment 7 Maciej Pilichowski 2008-06-15 11:07:00 UTC
ad.1) not at all, setting from Konqueror should be accepted in Kate, note that the settings should be set just for current file (manually), so nothing is written to the disk as configuration file
Comment 8 Dominik Haumann 2009-06-04 23:58:56 UTC
related bug for .kateconfig file: bug #125974
related bug for kate modelines  : bug #187033
Comment 9 Axel Müller 2009-12-16 14:25:46 UTC
Bug is still valid for KDE 4.3.2 (Kubuntu 9.10). As mentioned in comment #4 KWrite from KDE 3.5 did support this feature.
Comment 10 janow49420 2010-10-19 16:02:02 UTC
I've noticed this has change, slightly.

Using KDE 4.5.2 it's only screwed up the first time you open the file if you close it again and reopen it, it'll work fine.
Comment 11 Christoph Cullmann 2011-06-25 21:25:33 UTC
the encoding: xxx variable is removed for KDE 4.8, it does simply not work and we have no manpower to implement that correctly