aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/codeconv.c43
-rw-r--r--src/textview.c5
2 files changed, 19 insertions, 29 deletions
diff --git a/src/codeconv.c b/src/codeconv.c
index c8329681..d78c2439 100644
--- a/src/codeconv.c
+++ b/src/codeconv.c
@@ -797,6 +797,8 @@ void conv_utf8todisp(gchar *outbuf, gint outlen, const gchar *inbuf)
static void conv_anytodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
{
conv_anytoutf8(outbuf, outlen, inbuf);
+ if (g_utf8_validate(outbuf, -1, NULL) != TRUE)
+ conv_unreadable_8bit(outbuf);
}
static void conv_ustodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
@@ -815,7 +817,7 @@ void conv_localetodisp(gchar *outbuf, gint outlen, const gchar *inbuf)
strncpy2(outbuf, tmpstr, outlen);
g_free(tmpstr);
} else
- strncpy2(outbuf, inbuf, outlen);
+ conv_utf8todisp(outbuf, outlen, inbuf);
}
static void conv_noconv(gchar *outbuf, gint outlen, const gchar *inbuf)
@@ -1545,40 +1547,33 @@ void conv_unmime_header_overwrite(gchar *str)
{
gchar *buf;
gint buflen;
- CharSet cur_charset;
- cur_charset = conv_get_locale_charset();
+ buflen = strlen(str) * 2 + 1;
+ Xalloca(buf, buflen, return);
- if (cur_charset == C_EUC_JP) {
- buflen = strlen(str) * 2 + 1;
- Xalloca(buf, buflen, return);
+ if (conv_get_locale_charset() == C_EUC_JP)
conv_anytodisp(buf, buflen, str);
- unmime_header(str, buf);
- } else {
- buflen = strlen(str) + 1;
- Xalloca(buf, buflen, return);
- unmime_header(buf, str);
- strncpy2(str, buf, buflen);
- }
+ else
+ conv_localetodisp(buf, buflen, str);
+
+ unmime_header(str, buf);
}
void conv_unmime_header(gchar *outbuf, gint outlen, const gchar *str,
const gchar *charset)
{
- CharSet cur_charset;
-
- cur_charset = conv_get_locale_charset();
+ gchar *buf;
+ gint buflen;
- if (cur_charset == C_EUC_JP) {
- gchar *buf;
- gint buflen;
+ buflen = strlen(str) * 2 + 1;
+ Xalloca(buf, buflen, return);
- buflen = strlen(str) * 2 + 1;
- Xalloca(buf, buflen, return);
+ if (conv_get_locale_charset() == C_EUC_JP)
conv_anytodisp(buf, buflen, str);
- unmime_header(outbuf, buf);
- } else
- unmime_header(outbuf, str);
+ else
+ conv_localetodisp(buf, buflen, str);
+
+ unmime_header(outbuf, buf);
}
#define MAX_LINELEN 76
diff --git a/src/textview.c b/src/textview.c
index c0115fa0..48f6e90c 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -1247,11 +1247,6 @@ static void textview_show_header(TextView *textview, GPtrArray *headers)
!g_strcasecmp(header->name, "Cc"))
unfold_line(header->body);
-#if 0
- if (textview->text_is_mb == TRUE)
- conv_unreadable_locale(header->body);
-#endif
-
if (prefs_common.enable_color &&
(!strncmp(header->name, "X-Mailer", 8) ||
!strncmp(header->name, "X-Newsreader", 12)) &&