Bug 202409

Summary: kwrite does not apply per-directory setting for encoding from .kateconfig properly
Product: [Applications] kate Reporter: H.H. <cyberbeat>
Component: encodingAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Unspecified   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description H.H. 2009-08-03 18:15:43 UTC
Version:            (using Devel)
Installed from:    Compiled sources

I have configured kwrite with default encoding iso-8859-1.

In a directory I have a file named ".kateconfig" with only one entry:

kate: encoding utf8;

If I open a file from this directory, the file is displayed as ISO-8859-1, although in the extras->encoding menu-entry UTF-8 is selected as it should. But I have to select it manually again to have the utf-8 encoding applied.

This shows, that the configuration from .kateconfig is really read, but not correctly applied. (I tried without the config-file: then in the menu iso-8859-1 was selected)

This bug appears in kwrite from trunk, but also in kwrite/kde3 ( I would really really like to see this fixed in both versions!)
Comment 1 H.H. 2009-08-08 10:40:15 UTC
would be nice to get feedback, because I often save my files from different projects in wrong encoding by mistake, and I don't know any alternative to solve this problem. per-folder config seems to be a unique but really usable feature, if it would work.
Comment 2 H.H. 2009-09-18 18:16:37 UTC
does someone read this? this is a really serious bug..

I had a look into kate sourcecode. In katedocument.cpp readconfig() is called after loading the file, but the for the encoding to be set, the file has to be reloaded?  I don't know if I get fixed this by myself..
Comment 3 H.H. 2009-09-18 22:03:34 UTC
I have patched the function "openfile()" in katedocument.cpp to call "readconfig()" before loading the file. I think it shouldn't matter if we read the config file even, if the load does not succeed, or am I wrong? Seems to work so far.

 // read dir config (if possible and wanted)
  readDirConfig ();

  // do we have success ?
  bool success = m_buffer->openFile (m_file);
Comment 4 H.H. 2009-10-11 12:01:44 UTC
my workaround is not the optimal solution, because now, if kate finds a config-file, I cannot change the encoding manually afterwards for files in that directories, but for me it's still better as before.
Comment 5 Dominik Haumann 2010-02-19 13:19:34 UTC

*** This bug has been marked as a duplicate of bug 125974 ***