[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 132487] Messed up text conaining german umlauts in html messages
From:       Allen Winter <winter () kde ! org>
Date:       2007-03-16 22:06:23
Message-ID: 20070316220623.14844.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=132487         
winter kde org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From winter kde org  2007-03-16 23:06 -------
SVN commit 643332 by winterz:

SVN commit 643330 by winterz:

Fix "Messed up text conaining german umlauts in html messages when they were
saved in drafts folder and opened again from there".

Patch from  Michal Bukovsky, thanks Michal!

BUGS: 132487


 M  +19 -9     kmcomposewin.cpp  


--- branches/KDE/3.5/kdepim/kmail/kmcomposewin.cpp #643331:643332
 @ -1844,20 +1844,32  @
 
   mEditor->setText( otp.textualContent() );
   mCharset = otp.textualContentCharset();
-  if ( mCharset.isEmpty() )
-    mCharset = mMsg->charset();
-  if ( mCharset.isEmpty() )
-    mCharset = mDefCharset;
-  setCharset( mCharset );
-
   if ( partNode * n = root->findType( DwMime::kTypeText, DwMime::kSubtypeHtml ) )
     if ( partNode * p = n->parentNode() )
       if ( p->hasType( DwMime::kTypeMultipart ) &&
            p->hasSubType( DwMime::kSubtypeAlternative ) )
         if ( mMsg->headerField( "X-KMail-Markup" ) == "true" ) {
           toggleMarkup( true );
-          mEditor->setText(n->encodedBody() );
+
+          // get cte decoded body part
+          mCharset = n->msgPart().charset();
+          QCString bodyDecoded = n->msgPart().bodyDecoded();
+
+          // respect html part charset
+          const QTextCodec *codec = KMMsgBase::codecForName( mCharset );
+          if ( codec ) {
+            mEditor->setText( codec->toUnicode( bodyDecoded ) );
+          } else {
+            mEditor->setText( QString::fromLocal8Bit( bodyDecoded ) );
+          }
         }
+
+  if ( mCharset.isEmpty() )
+    mCharset = mMsg->charset();
+  if ( mCharset.isEmpty() )
+    mCharset = mDefCharset;
+  setCharset( mCharset );
+
   /* Handle the special case of non-mime mails */
   if ( mMsg->numBodyParts() == 0 && otp.textualContent().isEmpty() ) {
     mCharset=mMsg->charset();
 @ -1875,8 +1887,6  @
     } else
       mEditor->setText(QString::fromLocal8Bit(bodyDecoded));
   }
-
-
 #ifdef BROKEN_FOR_OPAQUE_SIGNED_OR_ENCRYPTED_MAILS
   const int num = mMsg->numBodyParts();
   kdDebug(5006) << "KMComposeWin::setMsg() mMsg->numBodyParts="
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic