Bug 95054

Summary: Encodings in Kompare
Product: [Applications] kompare Reporter: Alexander Glusker <bugs>
Component: generalAssignee: Jeff Snyder <jeff-kdecvs>
Status: RESOLVED FIXED    
Severity: normal CC: grundleborg, kde, vsangeeta27
Priority: NOR    
Version: 3.3   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Two files in UTF-8
Patch against encoding issues

Description Alexander Glusker 2004-12-13 08:23:34 UTC
Version:           3.3 (using KDE 3.3.2, Gentoo)
Compiler:          gcc version 3.4.3 20041125 (Gentoo Linux 3.4.3-r1, ssp-3.4.3-0, pie-8.7.7)
OS:                Linux (i686) release 2.6.9-gentoo-r9

The choice of the encoding does not influence work of the appendix. At record Russian letters vary on signs on a question.
Comment 1 Jeff Snyder 2004-12-20 04:08:47 UTC
I'm not sure exactly what this means, but I am aware that Kompare does not always honour the system's locale settings properly at the moment.

Alex: Could you please be more specific about the problem here? - I need to know what encoding you think kompare *should* be using, what you have done to try and make it use the encoding you want, and what encoding it appears to be using.

I'm afraid that information about how Russian writing is done isn't all that helpful, and I have no idea what you meant about an appendix.

Other information that can help:
- the output of the 'locale' command in a terminal
- screenshots of the text in kompare and the text rendered properly (i.e in another application)
- the files you are comparing

All of the above can either be entered as comments or attached as files to this bug report.

- Jeff
Comment 2 Alexander Glusker 2004-12-20 05:50:04 UTC
Locale: 
LANG=ru_RU.KOI8-R
LC_CTYPE="ru_RU.KOI8-R"
LC_NUMERIC="ru_RU.KOI8-R"
LC_TIME="ru_RU.KOI8-R"
LC_COLLATE="ru_RU.KOI8-R"
LC_MONETARY="ru_RU.KOI8-R"
LC_MESSAGES="ru_RU.KOI8-R"
LC_PAPER="ru_RU.KOI8-R"
LC_NAME="ru_RU.KOI8-R"
LC_ADDRESS="ru_RU.KOI8-R"
LC_TELEPHONE="ru_RU.KOI8-R"
LC_MEASUREMENT="ru_RU.KOI8-R"
LC_IDENTIFICATION="ru_RU.KOI8-R"
LC_ALL=

Encoding of file: cp1251
Comment 3 Bozidar Proevski 2005-01-06 02:12:56 UTC
I'm having the same problem. I have a testcase of two simple files with cyrillic text in UTF-8. When selecting the files, I select encoding "utf8" in the combobox. Kompare opens the files, but the text shows in iso8859-1. I've downloaded kompare from CVS (both HEAD and KDE_3_3_BRANCH), compiled it, behavior is the same. Debug messages confirm that the first file opens in UTF-8 (or whatever was chosen), but the diff is opened in iso8859-1. I changed two calls to KGlobal::charsets()->codecForName(encoding.latin1()) in komparemodellist.cpp and kompareprocess.cpp with QTextCodec::codecForName(encoding.latin1()) and now UTF-8 shows but kompare crashes with any other encoding. 
Using Slackware 10.0 with KDE 3.3.1 downloaded from KDEs servers...
Comment 4 Bozidar Proevski 2005-01-06 02:15:27 UTC
Created attachment 8942 [details]
Two files in UTF-8
Comment 5 Jeff Snyder 2005-01-06 04:33:16 UTC
Hi Bozidar, 

Thanks for taking a look at this - I just took a look at the docs, and KGlobal::charsets()->codecforname will return a Latin-1 codec if the requested one is not found, wheras QTextCodec returns NULL. This is probably the cause of the crash.. however, I can't think why KGlobal::charsets() would give different results to QTextCodec for a codec like utf8.. I'll take a closer look at this sometime soon(ish)

Cheers,

Jeff
Comment 6 Jeff Snyder 2005-04-25 06:35:24 UTC
*** Bug 104459 has been marked as a duplicate of this bug. ***
Comment 7 Jan Zimmerschied 2007-05-17 17:51:56 UTC
Created attachment 20607 [details]
Patch against encoding issues

This patch resolves the problem of wrong displayed characters e.g. two utf8
files compared against each other and the output of kompare is not utf8.

Simon Kim wrote (in Bug: 39108) on 2006-04-19 the idea of this patch, but the
code wasn't implemented into kompare source right now.

May be this patch resolves some other bugs: 112729, 39108
Comment 8 George Goldberg 2007-12-19 09:19:19 UTC
This is fixed in trunk for KDE4 and the KDE 3.5 branch.