KWrite leaves a working copy when the document is modified and it loses the connection to the X server or gets killed. When KWrite opens the same document again, it offers the user to review the changes using Kompare. However, the working copy is always sent as UTF–8. Kompare loads the working copy as UTF–8 and the original document as UTF–8 as well. If the character set of the original document was ISO 8859–2, Kompare shows invalid characters in places where the original document used to have extended characters and reports all lines containing such as changed since the latest commit even though they have not been. Reproducible: Always Steps to Reproduce: 1. Tell KWrite to create a new document. 2. Enter the following text: KWrite używa mechanizmu przeciągnij-i-upuść środowiska KDE. Pliki mogą być przeciągnięte i upuszczone w okno KWrite z pulpitu, z przeglądarki Dolphin lub niektórych zdalnych serwerów FTP, otwartych w oknie Dolphina. 3. Tell KWrite to save the text document as kwrite-changes.txt using character set ISO 8859–2. 4. Enter the following text: KWrite używa mechanizmu przeciągnij-i-upuść środowiska KDE. Pliki mogą być przeciągnięte i upuszczone w okno KWrite z pulpitu, z przeglądarki Dolphin lub niektórych zdalnych serwerów FTP, otwartych w oknie Dolphina. 5. Tell the System Monitor to kill KWrite. 6. Tell KWrite to open the file kwrite-changes.txt using ISO 8859–2 character set. 7. Tell KWrite to show the changes. Actual Results: 6. KWrite offers you to view the changes made since the latest commit. 7. Everything has apparently changed; Kompare shows invalid characters in the right window. Expected Results: 7. Let the two initial lines be the same, with three lines appended. Workaround: 1. Tell KWrite to recover the uncommitted changes. 2. Tell KWrite to save the document as kwrite-changed.txt. 3. Kompare kwrite-changes.txt to kwrite-changed.txt. This will not save you from the invalid characters problem (Bug 267186) but it may allow you to review at least the regions that actually changed.
Created attachment 72960 [details] The malformed diff that KWrite sends to Kompare The diff is partly in UTF–8 and partly in ISO 8859–2.
Right, we use the `diff` command to create the diff that is passed to kompare. Is there a ways to tell diff the encoding of this?
(In reply to comment #2) > Right, we use the `diff` command to create the diff that is passed to > kompare. Is there a ways to tell diff the encoding of this? If there were, it would be a violation of the "do one thing" rule. We have to convert the original to UTF–8 for diffing.
Will fix that ;)
Git commit e60f20a419448ff958b9c37dd85a59bfd6d42902 by Christoph Cullmann. Committed on 02/11/2012 at 20:41. Pushed by cullmann into branch 'master'. ensure we write diff files in UTF-8, no matter what original encoding then pass the diff output 1:1 to kompare or whatever M +48 -27 part/swapfile/katerecoverbar.cpp M +4 -1 part/swapfile/katerecoverbar.h http://commits.kde.org/kate/e60f20a419448ff958b9c37dd85a59bfd6d42902