Bug 228172 - Dolphin displays text file previews with wrong encoding
Summary: Dolphin displays text file previews with wrong encoding
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Frameworks and Libraries
Component: thumbnail (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Unassigned bugs mailing-list
URL:
Keywords:
: 236695 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-02-23 10:13 UTC by Māris Nartišs
Modified: 2011-02-20 01:02 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Dolphin displays text file with wrong encoding (338.50 KB, image/png)
2010-02-23 10:17 UTC, Māris Nartišs
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Māris Nartišs 2010-02-23 10:13:49 UTC
Version:           1.4 (using 4.4.00 (KDE 4.4.0), Gentoo)
Compiler:          x86_64-pc-linux-gnu-gcc
OS:                Linux (x86_64) release 2.6.32-gentoo

On system with UTF-8 locale Dolphin file previews (Info panel, mouse-over) display text files with wrong encoding.

Steps to reproduce:
Create text file with UTF-8 content where the one of first non-latin symbols is letter "ē" (i.e. echo "Šķēle" > myfile) Text lenght isn't crittical. Plain letter "ē" also is just fine to reproduce issue.
Look file content preview in Dolphin.

 * Searching for *qt* ...
[IP-] [  ] app-emulation/emul-linux-x86-qtlibs-20100220:0
[IP-] [  ] media-video/qt-recordmydesktop-0.3.8:0
[I--] [??] virtual/poppler-qt4-0.12.3-r1:0
[IP-] [  ] x11-libs/qt-3.3.8b-r2:3
[IP-] [  ] x11-libs/qt-core-4.6.2-r1:4
[IP-] [  ] x11-libs/qt-dbus-4.6.2:4
[IP-] [  ] x11-libs/qt-gui-4.6.2:4
[IP-] [  ] x11-libs/qt-opengl-4.6.2:4
[IP-] [  ] x11-libs/qt-qt3support-4.6.2:4
[IP-] [  ] x11-libs/qt-script-4.6.2:4
[IP-] [  ] x11-libs/qt-sql-4.6.2:4
[IP-] [  ] x11-libs/qt-svg-4.6.2:4
[IP-] [  ] x11-libs/qt-test-4.6.2:4
[IP-] [  ] x11-libs/qt-webkit-4.6.2:4
[IP-] [  ] x11-libs/qt-xmlpatterns-4.6.2:4
[IP-] [  ] x11-libs/qtscriptgenerator-0.1.0:0
Comment 1 Māris Nartišs 2010-02-23 10:17:13 UTC
Created attachment 41029 [details]
Dolphin displays text file with wrong encoding

Where do those Chinese glyphs come from?!?
Comment 2 Christoph Feck 2010-02-24 01:02:40 UTC
The Chinese glyphs come from wrong detection of the text encoding. I tried using KEncodingProber::confidence(), but I could not get it to be "unsure" even for small text files.
Comment 3 Māris Nartišs 2010-02-24 20:24:18 UTC
I have no idea how it works internally, but if it's not possible to make a good guess, maybe it should use following logic: guess fail back to: locale fail back to: UTF-8.
Displaying ASCII (C) as UTF-8 will have no harm; It's more than likely that file encoding will match locale encoding (i.e. in my case it's lv_LV.utf8). Of course, if it's possible to make encoding guessing more robust - it's way to go.
Comment 4 Christoph Feck 2010-03-16 04:27:27 UTC
SVN commit 1103862 by cfeck:

Use default locale encoding unless it is UTF

It has to be seen if it is better to assume the locale
encoding than to guess a wrong encoding.

CCBUG: 228172


 M  +15 -3     textcreator.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1103862
Comment 5 Christoph Feck 2010-05-09 17:57:05 UTC
*** Bug 236695 has been marked as a duplicate of this bug. ***
Comment 6 Andrés 2010-05-29 10:33:27 UTC
I didn't have this problem until I updated from kdemod 4.4.3 to regular kde 4.4.80 so I guess it's a configuration isuue, because 4.4.3 had cfeck's patch.
I'm using ArchLinux x86_64 and my locale is es_AR.utf8
Comment 7 Christoph Feck 2010-05-29 13:23:46 UTC
Andrés, the patch from comment #4 went to trunk (4.5), not 4.4 branch.
Comment 8 Andrés 2010-05-30 09:18:45 UTC
Then the patch is not working for me.
Comment 9 Māris Nartišs 2011-02-20 01:02:58 UTC
Seems to be working just fine with 4.6.0.