Bug 677111 - utf-7 encoded characters are not interpreted properly in TB 5.0. r=bienvenu,a=Standard8
authorSimon Montagu <smontagu@smontagu.org>
Mon, 07 Nov 2011 21:56:36 +0200
changeset 10122 93f5b1f340bbdb8cdc26fd4355a464acefe8060e
parent 10121 da70672b466aa1ce1c30a8f0d939c03d81826f9b
child 10123 ba2f0d434933f3c8a6b36a973c5194b31c94c034
push idunknown
push userunknown
push dateunknown
reviewersbienvenu, Standard8
bugs677111
Bug 677111 - utf-7 encoded characters are not interpreted properly in TB 5.0. r=bienvenu,a=Standard8
mailnews/base/util/nsMsgI18N.cpp
mailnews/mime/src/comi18n.cpp
--- a/mailnews/base/util/nsMsgI18N.cpp
+++ b/mailnews/base/util/nsMsgI18N.cpp
@@ -159,17 +159,17 @@ nsresult nsMsgI18NConvertToUnicode(const
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr <nsIUnicodeDecoder> decoder;
 
   // get an unicode converter
   if (aIsCharsetCanonical)  // optimize for modified UTF-7 used by IMAP
     rv = ccm->GetUnicodeDecoderRawInternal(aCharset, getter_AddRefs(decoder));
   else
-    rv = ccm->GetUnicodeDecoder(aCharset, getter_AddRefs(decoder));
+    rv = ccm->GetUnicodeDecoderInternal(aCharset, getter_AddRefs(decoder));
   NS_ENSURE_SUCCESS(rv, rv);
 
   const char *originalSrcPtr = inString.get();
   const char *currentSrcPtr = originalSrcPtr;
   PRInt32 originalLength = inString.Length();
   PRInt32 srcLength;
   PRInt32 dstLength;
   PRUnichar localbuf[512];
--- a/mailnews/mime/src/comi18n.cpp
+++ b/mailnews/mime/src/comi18n.cpp
@@ -782,17 +782,20 @@ MIME_get_unicode_decoder(const char* aIn
   nsCOMPtr<nsICharsetConverterManager> ccm =
            do_GetService(NS_CHARSETCONVERTERMANAGER_CONTRACTID, &res);
   if (NS_SUCCEEDED(res)) {
 
     // create a decoder (conv to unicode), ok if failed if we do auto detection
     if (!*aInputCharset || !PL_strcasecmp("us-ascii", aInputCharset))
       res = ccm->GetUnicodeDecoderRaw("ISO-8859-1", aDecoder);
     else
-      res = ccm->GetUnicodeDecoder(aInputCharset, aDecoder);
+      // GetUnicodeDecoderInternal in order to support UTF-7 messages
+      //
+      // XXX this means that even HTML messages in UTF-7 will be decoded
+      res = ccm->GetUnicodeDecoderInternal(aInputCharset, aDecoder);
   }
 
   return res;
 }
 
 //Get unicode encoder(from unicode to inputcharset) for aOutputCharset
 nsresult
 MIME_get_unicode_encoder(const char* aOutputCharset, nsIUnicodeEncoder **aEncoder)