Bug #46881 --> set the charset correctly for mutlipart/alternative

r=rhp
This commit is contained in:
mscott%netscape.com 2000-08-08 04:09:26 +00:00
Родитель 1b7064e389
Коммит 63867f7340
1 изменённых файлов: 9 добавлений и 17 удалений

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

@ -206,24 +206,17 @@ MimeMultipart_parse_line (char *line, PRInt32 length, MimeObject *obj)
// we need to tell the emitter that this is the case for use in in any // we need to tell the emitter that this is the case for use in in any
// possible reply or forward operation. // possible reply or forward operation.
// //
PRBool isAlternativeOrRelated; PRBool isAlternativeOrRelated = PR_FALSE;
PRBool isBody = MimeObjectChildIsMessageBody(obj, &isAlternativeOrRelated); PRBool isBody = MimeObjectChildIsMessageBody(obj, &isAlternativeOrRelated);
if (isBody) if ( (isAlternativeOrRelated || isBody) && obj->options)
{ {
MimeContainer *container = (MimeContainer*) obj; char *ct = MimeHeaders_get(mult->hdrs, HEADER_CONTENT_TYPE, PR_FALSE, PR_FALSE);
// If we have only one child and this is the message body object, if (ct)
// this we should check for a special charset and notify the emitter {
// if one exists! char *cset = MimeHeaders_get_parameter (ct, "charset", NULL, NULL);
if ( (container->children) && (container->nchildren == 1) && (obj->options) ) if (cset)
{ {
char *ct = MimeHeaders_get(mult->hdrs, HEADER_CONTENT_TYPE, PR_FALSE, PR_FALSE);
if (ct)
{
char *cset = MimeHeaders_get_parameter (ct, "charset", NULL, NULL);
if (cset)
{
mimeEmitterUpdateCharacterSet(obj->options, cset); mimeEmitterUpdateCharacterSet(obj->options, cset);
if (!(obj->options->override_charset)) if (!(obj->options->override_charset))
{ {
// Also set this charset to msgWindow // Also set this charset to msgWindow
@ -237,9 +230,8 @@ MimeMultipart_parse_line (char *line, PRInt32 length, MimeObject *obj)
PR_FREEIF(ct); PR_FREEIF(ct);
PR_FREEIF(cset); PR_FREEIF(cset);
} }
} }
} }
}
break; break;
} }