From e60bf4fc19e3a6289252afbe227b5b18c5f48516 Mon Sep 17 00:00:00 2001 From: "nhotta%netscape.com" Date: Tue, 6 Apr 1999 02:08:34 +0000 Subject: [PATCH] Fixed to map us-ascii to Latin1 for unicode coversion. --- mailnews/mime/src/comi18n.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/mailnews/mime/src/comi18n.cpp b/mailnews/mime/src/comi18n.cpp index 02920072aabf..3441382771b3 100644 --- a/mailnews/mime/src/comi18n.cpp +++ b/mailnews/mime/src/comi18n.cpp @@ -1534,7 +1534,10 @@ PRUint32 MIME_ConvertCharset(const char* from_charset, const char* to_charset, PRUint32 MIME_ConvertToUnicode(const char* from_charset, const char* inCstring, void** uniBuffer, PRInt32* uniLength) { - return INTL_ConvertToUnicode(from_charset, inCstring, PL_strlen(inCstring), uniBuffer, uniLength); + char charset[kMAX_CSNAME]; + // Since we don't have a converter us-ascii and the manager does not map, we do the mapping here. + PL_strcpy(charset, PL_strcasecmp(from_charset, "us-ascii") ? (char *) from_charset : "iso-8859-1"); + return INTL_ConvertToUnicode(charset, inCstring, PL_strlen(inCstring), uniBuffer, uniLength); } PRUint32 MIME_ConvertFromUnicode(const char* to_charset, const void* uniBuffer, const PRInt32 uniLength, @@ -1550,9 +1553,10 @@ extern "C" char *MIME_DecodeMimePartIIStr(const char *header, char *charset) if (header == 0) return nsnull; - // No MIME encoded, duplicate the input - if (*header == '\0' || intlmime_is_mime_part2_header(header)) { + // No MIME encoded, duplicate the input and put us-ascii as a charset + if (*header == '\0' || !intlmime_is_mime_part2_header(header)) { result = PL_strdup(header); + PL_strcpy(charset, "us-ascii"); } else { char *header_copy = PL_strdup(header); // avoid to modify the original string