Dr. Werner Fink 2012-03-23 18:41:10 +00:00 committed by Git OBS Bridge
parent f51b9d1be9
commit ca7abefa3b
2 changed files with 68 additions and 3 deletions

View File

@ -12,7 +12,7 @@
enum tdflags {
--- mime.c
+++ mime.c 2012-03-23 13:50:06.000000000 +0000
+++ mime.c 2012-03-23 18:36:39.777934029 +0000
@@ -302,13 +302,78 @@ gettcharset(void)
return t;
}
@ -110,6 +110,24 @@
}
#ifdef HAVE_ICONV
@@ -441,7 +507,7 @@ iconv_open_ft(const char *tocode, const
* be used to check the validity of the input even with
* identical encoding names.
*/
- if (strcmp(t, f) == 0)
+ if (asccasecmp(t, f) == 0)
errno = 0;
return (iconv_t)-1;
}
@@ -665,7 +731,7 @@ mime_tline(char *x, char *l)
l++;
if (*l != '\0')
*l++ = '\0';
- if (strcmp(x, n) == 0) {
+ if (asccasecmp(x, n) == 0) {
match = 1;
break;
}
@@ -748,11 +814,54 @@ mime_isclean(FILE *f)
maxlen = curlen;
curlen = 1;
@ -183,8 +201,49 @@
}
return convert;
}
@@ -989,8 +1103,12 @@ mime_fromhdr(struct str *in, struct str
#ifdef HAVE_ICONV
iconv_t fhicd = (iconv_t)-1;
#endif
+ encflags = 0;
tcs = gettcharset();
+ if (has_highbit(in->s))
+ encflags |= MIME_HIGHBIT;
+
maxstor = in->l;
out->s = smalloc(maxstor + 1);
out->l = 0;
@@ -1010,7 +1128,7 @@ mime_fromhdr(struct str *in, struct str
#ifdef HAVE_ICONV
if (fhicd != (iconv_t)-1)
iconv_close(fhicd);
- if (strcmp(cs, tcs))
+ if (asccasecmp(cs, tcs))
fhicd = iconv_open_ft(tcs, cs);
else
fhicd = (iconv_t)-1;
@@ -1105,12 +1223,17 @@ notmime:
}
fromhdr_end:
*q = '\0';
- if (flags & TD_ISPR) {
+ if ((flags & TD_ISPR) && (encflags & MIME_HIGHBIT)) {
struct str new;
+ if ((encflags & MIME_UTF8) && asccasecmp("utf-8", tcs) == 0)
+ goto skip;
+ if ((encflags & MIME_LATIN) && ascncasecmp("iso-8859-", tcs, 9) == 0)
+ goto skip;
makeprint(out, &new);
free(out->s);
*out = new;
}
+skip:
if (flags & TD_DELCTRL)
out->l = delctrl(out->s, out->l);
#ifdef HAVE_ICONV
--- sendout.c
+++ sendout.c 2012-03-23 13:46:32.000000000 +0000
+++ sendout.c 2012-03-23 18:30:50.949933289 +0000
@@ -226,6 +226,23 @@ attach_file1(struct attachment *ap, FILE
charset = ap->a_charset;
convert = get_mime_convert(fi, &contenttype, &charset, &isclean,
@ -235,7 +294,7 @@
tcs = gettcharset();
- if ((convhdr = need_hdrconv(hp, GTO|GSUBJECT|GCC|GBCC|GIDENT)) != 0) {
+ if ((convhdr = need_hdrconv(hp, GTO|GSUBJECT|GCC|GBCC|GIDENT)) != 0 &&
+ convhdr != NULL && tcs != NULL) {
+ tcs != NULL) {
if (iconvd != (iconv_t)-1)
iconv_close(iconvd);
if ((iconvd = iconv_open_ft(convhdr, tcs)) == (iconv_t)-1

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Mar 23 18:39:38 UTC 2012 - werner@suse.de
- Avoid header rewrite in case of specified ttycharset in wrong
locale but subject in ttycharset (bnc#753340)
-------------------------------------------------------------------
Fri Mar 23 14:01:02 UTC 2012 - werner@suse.de