[Bug 60670] Re: kate silently corrupts iso-8859-1 files in utf-8 locale

Jukka Suomela jukka.suomela at gmail.com
Tue Aug 21 09:06:49 UTC 2007


Some further comments regarding the behaviour of the latest version of
Kate (2.5.6) in Kubuntu.

As I have learned that Kate corrupts iso-8859-1 files in UTF-8 locale, I
have tried to make sure that Kate gets the encoding right by adding
"kate: encoding ..." directives in some files. However, this leads into
yet another trouble.

The following happens quite often; I am using a UTF-8 locale:

- I have an iso-8859-1 encoded file which is created somewhere else. The
file might be, for example, a Latex source code; it contains the
directive "% kate: encoding iso-8859-1" near the beginning of the file
and it also contains some non-ASCII characters encoded in iso-8859-1.

- I open the file in Kate (usually a Kate instance is already running; I
open files using "kate -u file.tex" from the command line).

- At this point I _should_ notice that the file is displayed using the
wrong encoding; non-ASCII characters are shown as squares. However, this
is very easy to miss if there are only few non-ASCII characters in the
file, especially if none of them are near the beginning of the file but
hidden somewhere in the middle of a long file.

- Therefore I simply start editing the file. I do changes here and there
and finally decide to save the changes. At this point Kate complains
that "the selected encoding cannot encode every Unicode character in the
file".

- Now I notice that all non-ASCII characters are indeed displayed as
squares. However, Tools / Encoding shows that iso-8859-1 is selected!

The trouble is that even though Tools / Encoding show iso-8859-1, Kate
did not properly read the file in this encoding. An now I am in trouble.
At this point I cannot reselect Tools / Encoding / iso-8859-1; Kate
would like to discard the changes and re-read the original file. And I
cannot even copy & paste the file into a new window and save it with the
correct encoding, because non-ASCII characters are garbage. I have to
re-open the file with the correct encoding and manually copy & paste
just those parts where I have done editing. Or something like that.

There is a workaround, but it is hard to remember that this must be done
every time:

- Check that non-ASCII characters (if any) are displayed correctly. If
not, re-select Tools / Encoding / iso-8859-1 immediately after opening
the file.

It seems that Kate remembers the correct setting for each file;
therefore if I do this once for a particular file (or if the file is
originally created with Kate on this computer), things work fine.

-- 
kate silently corrupts iso-8859-1 files in utf-8 locale
https://bugs.launchpad.net/bugs/60670
You received this bug notification because you are a member of Kubuntu
Team, which is a bug contact for kdebase in ubuntu.




More information about the kubuntu-bugs mailing list