* mu-msg.c: convert html mail to utf-8, too. this fixes the display of

non-utf8 html with chars outside ascii
This commit is contained in:
Dirk-Jan C. Binnema 2011-02-06 10:49:36 +02:00
parent 1276b77a17
commit d015b04c2a
1 changed files with 7 additions and 10 deletions

View File

@ -664,7 +664,7 @@ convert_to_utf8 (GMimePart *part, char *buffer)
static gchar* static gchar*
stream_to_string (GMimeStream *stream, size_t buflen, gboolean convert_utf8) stream_to_string (GMimeStream *stream, size_t buflen)
{ {
char *buffer; char *buffer;
ssize_t bytes; ssize_t bytes;
@ -687,7 +687,7 @@ stream_to_string (GMimeStream *stream, size_t buflen, gboolean convert_utf8)
static gchar* static gchar*
part_to_string (GMimePart *part, gboolean convert_utf8, gboolean *err) part_to_string (GMimePart *part, gboolean *err)
{ {
GMimeDataWrapper *wrapper; GMimeDataWrapper *wrapper;
GMimeStream *stream = NULL; GMimeStream *stream = NULL;
@ -716,12 +716,11 @@ part_to_string (GMimePart *part, gboolean convert_utf8, gboolean *err)
goto cleanup; goto cleanup;
} }
buffer = stream_to_string (stream, (size_t)buflen, convert_utf8); buffer = stream_to_string (stream, (size_t)buflen);
/* convert_to_utf8 will free the old 'buffer' if needed */ /* convert_to_utf8 will free the old 'buffer' if needed */
if (convert_utf8) buffer = convert_to_utf8 (part, buffer);
buffer = convert_to_utf8 (part, buffer);
*err = FALSE; *err = FALSE;
cleanup: cleanup:
@ -751,13 +750,11 @@ get_body (MuMsg *msg, gboolean want_html)
&data); &data);
if (want_html) if (want_html)
str = data._html_part ? str = data._html_part ?
part_to_string (GMIME_PART(data._html_part), part_to_string (GMIME_PART(data._html_part), &err) :
FALSE, &err) :
NULL; NULL;
else else
str = data._txt_part ? str = data._txt_part ?
part_to_string (GMIME_PART(data._txt_part), part_to_string (GMIME_PART(data._txt_part), &err) :
TRUE, &err) :
NULL; NULL;
/* note, str may be NULL (no body), but that's not necessarily /* note, str may be NULL (no body), but that's not necessarily