When parsing HTML attachment, ignore UTF-16 charset label because the function is not supposed to parse it,

also avoid the parse when the attachment already has a charset assigned,
bug 160729, r=ducarroz, sr=bienvenu.
This commit is contained in:
nhotta%netscape.com 2002-08-12 19:10:18 +00:00
Родитель 40f4b5a5c5
Коммит 0895bbb959
2 изменённых файлов: 14 добавлений и 1 удалений

Просмотреть файл

@ -532,6 +532,16 @@ nsMsgI18NParseMetaCharset(nsFileSpec* fileSpec)
{
PL_strncpy(charset, token, sizeof(charset));
charset[sizeof(charset)-1] = '\0';
// this function cannot parse a file if it is really
// encoded by one of the following charsets
// so we can say that the charset label must be incorrect for
// the .html if we actually see those charsets parsed
// and we should ignore them
if (!nsCRT::strncasecmp("UTF-16", charset, sizeof("UTF-16")-1) ||
!nsCRT::strncasecmp("UTF-32", charset, sizeof("UTF-32")-1))
charset[0] = '\0';
break;
}
}

Просмотреть файл

@ -953,8 +953,11 @@ nsMsgAttachmentHandler::UrlExit(nsresult status, const PRUnichar* aMsg)
// First things first, we are now going to see if this is an HTML
// Doc and if it is, we need to see if we can determine the charset
// for this part by sniffing the HTML file.
// This is needed only when the charset is not set already.
// (e.g. a charset may be specified in HTTP header)
//
if ( (m_type) && (*m_type) )
if ( (m_type) && (*m_type) &&
(!m_charset || !(*m_charset)) )
{
if (PL_strcasecmp(m_type, TEXT_HTML) == 0)
{