Bug 304573 - KWrite sends changes to Kompare in incompatible character sets
Summary: KWrite sends changes to Kompare in incompatible character sets
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: kwrite (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-04 20:51 UTC by Christopher Yeleighton
Modified: 2012-11-02 19:42 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
The malformed diff that KWrite sends to Kompare (679 bytes, patch)
2012-08-04 20:55 UTC, Christopher Yeleighton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christopher Yeleighton 2012-08-04 20:51:44 UTC
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.
Comment 1 Christopher Yeleighton 2012-08-04 20:55:16 UTC
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.
Comment 2 Dominik Haumann 2012-08-06 08:14:50 UTC
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?
Comment 3 Christopher Yeleighton 2012-08-06 17:49:53 UTC
(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.
Comment 4 Christoph Cullmann 2012-11-02 08:12:50 UTC
Will fix that ;)
Comment 5 Christoph Cullmann 2012-11-02 19:42:28 UTC
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