Bug 359063

Summary: Plain text version of html-only message is not respecting encoding specified in html message
Product: [Applications] kdepim Reporter: Martin Kostolný <clearmartin>
Component: messageviewerAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: fischer, null, richard-oss
Priority: NOR    
Version: 5.1.*   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Before rendering HTML code, showing rendering issues with iso-8859-1/quoted-printable-encoded HTML text
After confirming that HTML code should be rendered
Simple Perl script that sends a mail with HTML and quoted-printable iso-8859-1 content

Description Martin Kostolný 2016-02-06 12:09:25 UTC
When reading html-only messages (usually created in MS Exchange) in plain text mode they are showed with incorrect encoding. Switching to html-view encoding is used and text correctly displayed.

Reproducible: Always

Steps to Reproduce:
1. Have kmail with stock settings (no preferring html messages)
2. Recieve html-only message with encoding different from UTF-8


Actual Results:  
Message characters are displayed incorrectly (with some question mark like characters) - e.g. for czech specific characters

Expected Results:  
Message should be displayed using encoding specified in incoming html.

When replying in plaintext the message is attached inline correctly (no question marks) so the only problem is just displaying incoming message.

I have Plasma 5.5.4, KF 5.18, KDE Apps 15.12.1, Qt 5.5.1, (KMail 5.1.1)
Comment 1 Thomas Fischer 2016-02-11 20:11:47 UTC
I may have the same problem. My observation is as follows:
The user receives a HTML-only mail in an European language (which makes use of non-ASCII characters code 128-255 such as åäö), the mail is quoted-printable encoded.
My test case mail's source code looks like this:

<html><head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=
1">
<body>abc123=E5=E4=F6<br/>ABC123=C5=C4=D6</body>
</html>

The relevant mail headers look like this:
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset="iso-8859-1"

This mail should look like this when correctly displayed:

abc123åäö
ABC123ÅÄÖ

I'll attach two screen shots. One will reproduce how the mail is displayed in "non-HTML" mode, where a box is show for the use to "click here" to render the HTML code. The second screen shot reproduces the output of just this render.
Please observe the incorrect rendering in the first screenshot.
Comment 2 Thomas Fischer 2016-02-11 20:13:23 UTC
Created attachment 97157 [details]
Before rendering HTML code, showing rendering issues with iso-8859-1/quoted-printable-encoded HTML text
Comment 3 Thomas Fischer 2016-02-11 20:13:57 UTC
Created attachment 97158 [details]
After confirming that HTML code should be rendered
Comment 4 Thomas Fischer 2016-02-16 14:23:08 UTC
Created attachment 97245 [details]
Simple Perl script that sends a mail with HTML and quoted-printable iso-8859-1 content
Comment 5 resplin 2016-09-20 22:17:28 UTC
I'm seeing this in 5.3.0, even when the email doesn't have accents. Creating a plain-text reply to any HTML-only email results in the wrong encoding in the response.
Comment 6 null 2020-05-05 22:50:49 UTC
Cannot reproduce with a mail as generated by the script in Comment 4 using KMail git master. Respecting the encoding seems to be fixed in the meantime.

There is one issue left: The "<br>" is not displayed. However, this can be fixed by adding the missing "</head>", so that's more of an issue with the generated mail than something to work around in KMail.