[Bug 279809] KMail2 crash on viewing mail in gb2312 encoding, edit to UTF-8 fixes it

Axel Gonzalez loox at e-shell.net
Mon Sep 26 20:41:41 BST 2011


https://bugs.kde.org/show_bug.cgi?id=279809


Axel Gonzalez <loox at e-shell.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |loox at e-shell.net




--- Comment #9 from Axel Gonzalez <loox e-shell net>  2011-09-26 19:41:40 ---
I tested this with kdepim-4.7.1 and kdepimlibs-4.7.1 so YMMV

The problem is a NULL pointer reference in Content::decodedText() ,
kmime/kmime_content.cpp

This patch fixes it. The code is borrowed from Content::fromUnicodeString().

--- kmime/kmime_content.cpp.orig        2011-09-26 13:33:53.000000000 -0500
+++ kmime/kmime_content.cpp     2011-09-26 14:35:15.000000000 -0500
@@ -408,6 +408,12 @@
   QTextCodec *codec =
     KGlobal::charsets()->codecForName( QLatin1String( contentType()->charset()
), ok );

+  if ( !ok  || codec == NULL ) { // no suitable codec found => try local
settings and hope the best ;-)
+    codec = KGlobal::locale()->codecForEncoding();
+    QByteArray chset = KGlobal::locale()->encoding();
+    contentType()->setCharset( chset );
+  }
+
   QString s = codec->toUnicode( d_ptr->body.data(), d_ptr->body.length() );

   if ( trimText || removeTrailingNewlines ) {

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Kdepim-bugs mailing list