Bug 350774

Summary: Incorrect charset encoding viewing message from file
Product: [Applications] kmail2 Reporter: Raúl <rasasi78>
Component: composerAssignee: kdepim bugs <kdepim-bugs>
Status: REPORTED ---    
Severity: normal CC: baohaojun
Priority: NOR    
Version: 4.14.4   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Sample email with utf-8 text body
Sample email with iso-8859-1 text body (Content-Type UTF-8)
Sample email with iso-8859-1 text body (No Content-Type specified)

Description Raúl 2015-07-29 21:49:58 UTC
I have an email source in a text file. I use kmail --view <file name w/absolute path> to open it in a composer.
Even "Content-Type" header specifies UTF-8 charset, kmail composer is unable to cope with encoding, showing ugly characters instead of the right ones.

Reproducible: Always

Steps to Reproduce:
1. Download attached sample-email file
2. kmail --view $(pwd)/sample-email


Actual Results:  
Non-ascii characters, like 'á' are not shown properly

Expected Results:  
Non-ascii characters, like 'á' are shown properly

Debian unstable with kdepim and kdepimlibs from experimental. Plasma-desktop from KF5
Versions:
kdepim 4.14.5
kdepimlibs 4.14.6
kdelibs 4.14.2
qt4 4.8.7
qt5 5.4.2
kf5 5.12.0
Comment 1 Raúl 2015-07-29 21:50:55 UTC
Created attachment 93796 [details]
Sample email with utf-8 text body
Comment 2 Raúl 2015-07-29 21:57:06 UTC
Created attachment 93797 [details]
Sample email with iso-8859-1 text body (Content-Type UTF-8)
Comment 3 Raúl 2015-07-29 21:57:57 UTC
Created attachment 93798 [details]
Sample email with iso-8859-1 text body (No Content-Type specified)
Comment 4 Raúl 2015-07-29 22:14:23 UTC
Interestingly enough, I have the following results using "kmail --view" with these attached files:
- Sample email with iso-8859-1 text body (Content-Type UTF-8): Shown correctly, even Content-Type is wrongly specified as charset=UTF-8
- Sample email with iso-8859-1 text body (No Content-Type specified): Shown incorrectly.

I have tested Kmail preferences -> composer -> charset with default "us-ascii" as first option and prioritizing utf-8 (either as system locale or forced) with no differences in behaviour. 

Also when opening email file, I have tested changing encoding in view->set encoding. Default is auto, but trying utf-8 works for any of the iso-8859-1 encoded files. For utf-8 email, choosing utf-8 encoding in the view menu does not work and any other worsen things.

Doing kmail --view would be a typical use case when I want to send a git format-patch generated file.

I have experience this wrong behaviour since a long time ago. Only that I hadn't reported it. Also, I used to convert files to iso-8859-1 to sort out the issue.
Comment 5 Bao Haojun 2016-02-17 03:37:33 UTC
I have the same problem, and found a workaround for it:

http://baohaojun.github.io/blog/2016/02/17/0-kmail---view-cant-display-some-maildir-files-correctly.html
Comment 6 Justin Zobel 2021-03-11 01:23:51 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.