Bug 1540943 - Use DecodeWithoutBOMHandling() in nsMsgI18NConvertToUnicode() to handle bad characters better. r=hsivonen a=jorgk
authorJorg K <jorgk@jorgk.com>
Mon, 19 Aug 2019 09:53:28 +0200
changeset 36170 0cdb8a1fb8e8ed67be1fd89708e7d001542c562f
parent 36169 f513420103a459fa43ee6d3739b4434c52e959b0
child 36171 c6392cfb16a0a321b5a4883494cb1fe3cac79408
push id392
push userclokep@gmail.com
push dateMon, 02 Sep 2019 20:17:19 +0000
reviewershsivonen, jorgk
bugs1540943
Bug 1540943 - Use DecodeWithoutBOMHandling() in nsMsgI18NConvertToUnicode() to handle bad characters better. r=hsivonen a=jorgk
mailnews/base/util/nsMsgI18N.cpp
--- a/mailnews/base/util/nsMsgI18N.cpp
+++ b/mailnews/base/util/nsMsgI18N.cpp
@@ -93,18 +93,17 @@ nsresult nsMsgI18NConvertToUnicode(const
   if (newCharset.Equals("UTF-7", nsCaseInsensitiveCStringComparator())) {
     // Special treatment for decoding UTF-7 since it's not handled by
     // encoding_rs.
     return CopyUTF7toUTF16(inString, outString);
   }
 
   auto encoding = mozilla::Encoding::ForLabelNoReplacement(newCharset);
   if (!encoding) return NS_ERROR_UCONV_NOCONV;
-  return encoding->DecodeWithoutBOMHandlingAndWithoutReplacement(inString,
-                                                                 outString);
+  return encoding->DecodeWithoutBOMHandling(inString, outString);
 }
 
 // This is used to decode UTF-7. No support for encoding in UTF-7.
 nsresult CopyUTF7toUTF16(const nsACString& aSrc, nsAString& aDest) {
   // UTF-7 encoding size cannot be larger than the size in UTF-16.
   nsUTF7ToUnicode converter;
   int32_t inLen = aSrc.Length();
   int32_t outLen = inLen;