func = conv_get_code_conv_func(src_codeset);
if (func != conv_noconv) {
- if (func == conv_jistodisp || func == conv_sjistodisp)
+ if (func == conv_jistodisp ||
+ func == conv_sjistodisp ||
+ func == conv_anytodisp)
len = strlen(inbuf) * 2 + 1;
else
len = strlen(inbuf) + 1;
CodeConvFunc conv_get_code_conv_func(const gchar *charset)
{
CodeConvFunc code_conv;
+ CharSet cur_charset;
if (!charset) {
- if (conv_get_outgoing_charset() == C_ISO_2022_JP)
- return conv_jistodisp;
+ cur_charset = conv_get_current_charset();
+ if (cur_charset == C_EUC_JP || cur_charset == C_SHIFT_JIS)
+ return conv_anytodisp;
else
return conv_noconv;
}
void conv_unmime_header_overwrite(gchar *str)
{
gchar *buf;
- gint outlen;
+ gint buflen;
CharSet cur_charset;
cur_charset = conv_get_current_charset();
-#if HAVE_LIBJCONV
- Xstrdup_a(buf, str, return);
- outlen = strlen(str) + 1;
- UnMimeHeaderConv(buf, str, outlen);
if (cur_charset == C_EUC_JP) {
- gchar *tmp;
- gint len;
-
- len = strlen(str) * 2 + 1;
- Xalloca(tmp, len, return);
- conv_jistodisp(tmp, len, str);
- strncpy2(str, tmp, outlen);
+ buflen = strlen(str) * 2 + 1;
+ Xalloca(buf, buflen, return);
+ 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
- if (cur_charset == C_EUC_JP) {
- gchar *tmp;
- gint len;
-
- Xstrdup_a(buf, str, return);
- outlen = strlen(str) + 1;
- UnMimeHeader(buf);
- len = strlen(buf) * 2 + 1;
- Xalloca(tmp, len, {strncpy2(str, buf, outlen); return;});
- conv_anytodisp(tmp, len, buf);
- strncpy2(str, tmp, outlen);
- } else
- UnMimeHeader(str);
-#endif
}
void conv_unmime_header(gchar *outbuf, gint outlen, const gchar *str,
const gchar *charset)
{
- gchar *buf;
CharSet cur_charset;
cur_charset = conv_get_current_charset();
- Xstrdup_a(buf, str, return);
-#if HAVE_LIBJCONV
- UnMimeHeaderConv(buf, outbuf, outlen);
-#else
- UnMimeHeader(buf);
- strncpy2(outbuf, buf, outlen);
-#endif
if (cur_charset == C_EUC_JP) {
- gint len;
+ gchar *buf;
+ gint buflen;
- len = strlen(outbuf) * 2 + 1;
- Xalloca(buf, len, return);
- conv_anytodisp(buf, len, outbuf);
- strncpy2(outbuf, buf, outlen);
- }
+ buflen = strlen(str) * 2 + 1;
+ Xalloca(buf, buflen, return);
+ conv_anytodisp(buf, buflen, str);
+ unmime_header(outbuf, buf);
+ } else
+ unmime_header(outbuf, str);
}
#define MAX_ENCLEN 75
destp += mimehdr_begin_len;
line_len += mimehdr_begin_len;
- to64frombits(destp, raw, raw_len);
+ base64_encode(destp, raw, raw_len);
line_len += strlen(destp);
destp += strlen(destp);
destp += mimehdr_begin_len;
line_len += mimehdr_begin_len;
- to64frombits(destp, tmp_jis, strlen(tmp_jis));
+ base64_encode(destp, tmp_jis, strlen(tmp_jis));
line_len += strlen(destp);
destp += strlen(destp);