Bug 321848

Summary: Base64 decode on MBCS strings may carry out incomplete snippets
Product: [Applications] kmail2 Reporter: Korepwx <web>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: normal    
Priority: NOR    
Version: 4.10.3   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: The screenshot

Description Korepwx 2013-07-02 03:19:07 UTC
I'm a Chinese speaking user. I noticed that, if the original mail splits MBCS strings into incomplete 
base64 encoded snippets, Kmail will also decode it incompletely. Say that, if we have a mail with base64 encoded subjects like this:

Subject: =?utf-8?B?V2luZG93cyA4IOeOsOW3suWPkeW4g+OAgiDor7fnjrDlnKjl?=
 =?utf-8?B?sLHojrflj5bljYfnuqfjgII=?=

We can see that "V2luZG93cyA4IOeOsOW3suWPkeW4g+OAgiDor7fnjrDlnKjlsLHojrflj5bljYfnuqfjgII=" as a whole it carry out the sentence "Windows 8 现已发布。 请现在就获取升级。", while "V2luZG93cyA4IOeOsOW3suWPkeW4g+OAgiDor7fnjrDlnKjl" carrys out "Windows 8 现已发布。 请现在?" (there is an incomplete UTF-8 character at the end), and "sLHojrflj5bljYfnuqfjgII=" carrys out "??获取升级。" (again an incomplete UTF-8 character at the begining).

Not only mails from Microsoft (lol) behave like this. I receive mails from Facebook apps, and they have this problem as well. In fact, I think it should be all right if you put two piece of MBCS string together before you convert them into QString (yes, from MBCS to UTF-16), rather than join each as a whole.

Reproducible: Always

Steps to Reproduce:
1. You're using UTF-8, GBK, SHIFT_JIS or any MBCS character encoding.
2. The original mail may not agree with some formal restrictions, but they're still ok.
Actual Results:  
The MBCS strings are decoded incompletely.

Expected Results:  
MBCS strings should be put together and decoded completely.

http://goo.gl/KieAq, This is my screenshot.
Comment 1 Korepwx 2013-07-02 03:21:13 UTC
Created attachment 80892 [details]
The screenshot
Comment 2 Denis Kurz 2016-09-24 18:15:50 UTC
This bug has only been reported for versions before 4.14, which have been unsupported for at least two years now. Can anyone tell if this bug still present?

If noone confirms this bug for a Framework-based version of kmail2 (version 5.0 or later, as part of KDE Applications 15.12 or later), it gets closed in about three months.
Comment 3 Denis Kurz 2017-01-07 21:59:27 UTC
Just as announced in my last comment, I close this bug. If you encounter it again in a recent version (at least 5.0 aka 15.08), please open a new one unless it already exists. Thank you for all your input.