From 450e955e76ca9174658c0bb94e99e4174df2fe48 Mon Sep 17 00:00:00 2001 From: 4 Date: Mon, 24 Sep 2001 19:31:07 +0000 Subject: If the type is encoded, get the fallback charset from the message 2001-09-24 * camel-filter-search.c (check_header): If the type is encoded, get the fallback charset from the message content-type. * camel-mime-part-utils.c (check_html_charset): Dont check for charset==null before calling charset_to_iconv. (simple_data_wrapper_construct_from_parser): " * camel-mime-message.c (process_header): Try use content-type charset param as the fallback charset. * camel-charset-map.c (camel_charset_to_iconv): Handle name == NULL, return NULL. * camel-folder-summary.c (camel_folder_summary_format_address): (camel_folder_summary_format_string): Made private again, removed #warning about it. Renamed to s/camel_folder//. (summary_format_string): Take default charset param. (camel_message_info_new_from_header, message_info_new): Decode content-type field to get the charset parameter to use as the default charset for decoding strings. * camel-search-private.c (camel_search_header_match): Pass NULL as the charset, the locale charset is always tried. (camel_search_header_match): Supply a default_charset parameter to be used with TYPE_ENCODED params. * camel-mime-utils.c (header_param): get rid of the g_strcasecmp crap. (header_set_param): Same here. (header_decode_param_list): And here. (header_decode_text): Totally rewritten. 30% of its size. If the word is not rfc2047 encoded, always try default_charset if supplied, if that fails, try locale charset if it exists, if that fails then assume latin1/7 bit ascii. (append_8bit): Changed to return FALSE if we can't convert for whatever reason, and dont append anything. * camel-mime-part.h (struct _CamelMimePart): Move content_type and headers out of the 'private' section. * camel-mime-part.c (get_headers): Dont do any conversion on the header. (process_header): Get the content-type charset as the fallback charset for decode_string. (construct_from_parser): IF we have a content-type header, process it before doing anything else, so we have access to a fallback charset for invalid headers. svn path=/trunk/; revision=13096 --- camel/camel-mime-part-utils.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'camel/camel-mime-part-utils.c') diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c index a9e971ba58..ba9bf07d5f 100644 --- a/camel/camel-mime-part-utils.c +++ b/camel/camel-mime-part-utils.c @@ -80,8 +80,7 @@ check_html_charset(char *buffer, int length) && (val = camel_html_parser_attr(hp, "content")) && (ct = header_content_type_decode(val))) { charset = header_content_type_param(ct, "charset"); - if (charset) - charset = camel_charset_to_iconv (charset); + charset = camel_charset_to_iconv (charset); header_content_type_unref(ct); } break; @@ -189,8 +188,7 @@ simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser ct = camel_mime_parser_content_type(mp); if (header_content_type_is(ct, "text", "*")) { charset = header_content_type_param(ct, "charset"); - if (charset) - charset = camel_charset_to_iconv (charset); + charset = camel_charset_to_iconv (charset); if (fdec) { d(printf("Adding CRLF conversion filter\n")); -- cgit