Bug 445264

Summary: Decode decrypted message with wrong character encoding method
Product: [Applications] kmail2 Reporter: Yao Nianqing <imbearchild>
Component: cryptoAssignee: kdepim bugs <kdepim-bugs>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:

Description Yao Nianqing 2021-11-10 09:54:08 UTC
When KMail received an encrypted mail, it will use GnuPG to decrypt it,and GnuPG will send decrypted data back in UTF-8 (As long as that is text message), so KMail should display those data in UTF-8, too. But sometimes, while there's a header line that indicates charset, for example, `Content-Type: text/plain; charset="gb2312"`, KMail will display the decrypted data in that charset, not UTF-8. So that message will be unreadable.

STEPS TO REPRODUCE
1. Received an encrypted mail which indicates its non-UTF-8 charset. 
   You can send a email with inline GPG meaasge from a Chinese Win10 machine with built-in mail client of Win10 to make this. Or you can send a mail to yourself and move it to local maildir, then modify its header.
2. Decrypt it in KMail.

OBSERVED RESULT
Unreadable characters will display as decrypted message.

EXPECTED RESULT
Decode it properly.

SOFTWARE/OS VERSIONS
Operating System: openSUSE Tumbleweed 20211105
KDE Plasma Version: 5.23.2
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2
GnuPG: 2.2.27
libgcrypt: 1.9.4