aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-02-22 10:05:49 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2005-02-22 10:05:49 +0000
commitd759c99df0ad6f2b774691c82daf9fc18f57498d (patch)
tree55cc1abff1f58cc89c4d9ee33e5291ce9785dfe6
parentf38dc1d07970872159cba1209e58408078e690a5 (diff)
try to convert unencoded header strings using locale encoding.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@121 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog10
-rw-r--r--ChangeLog.ja12
-rw-r--r--configure.in2
-rw-r--r--src/codeconv.c43
-rw-r--r--src/textview.c5
5 files changed, 42 insertions, 30 deletions
diff --git a/ChangeLog b/ChangeLog
index d367e273..f1105c4c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2005-02-22
+
+ * src/codeconv.c:
+ conv_anytodisp(): check if converted string is valid UTF-8.
+ conv_localetodisp(): convert to valid UTF-8 if conv_iconv_strdup()
+ failed.
+ conv_unmime_header_overwrite()
+ conv_unmime_header(): try to convert unencoded strings using locale
+ encoding (thanks to Egor Yu. Shkerin and Oliver Lehmann).
+
2005-02-21
* version 1.9.3
diff --git a/ChangeLog.ja b/ChangeLog.ja
index e20edb91..c839469a 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,15 @@
+2005-02-22
+
+ * src/codeconv.c:
+ conv_anytodisp(): 変換された文字列が有効な UTF-8 かどうかを
+ チェック。
+ conv_localetodisp(): conv_iconv_strdup() が失敗したら有効な UTF-8
+ に変換するようにした。
+ conv_unmime_header_overwrite()
+ conv_unmime_header(): エンコードされていない文字列を locale
+ エンコーディングを使用して変換を試みるようにした(Egor Yu. Shkerin
+ さん、 Oliver Lehmann さん thanks)。
+
2005-02-21
* version 1.9.3
diff --git a/configure.in b/configure.in
index 36836181..c239d9dc 100644
--- a/configure.in
+++ b/configure.in
@@ -9,7 +9,7 @@ MINOR_VERSION=9
MICRO_VERSION=3
INTERFACE_AGE=0
BINARY_AGE=0
-EXTRA_VERSION=
+EXTRA_VERSION=+svn
VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
dnl set $target
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)) &&