Dr. Werner Fink 2012-03-30 14:52:32 +00:00 committed by Git OBS Bridge
parent ca7abefa3b
commit ba0f793ca4

View File

@ -12,7 +12,7 @@
enum tdflags {
--- mime.c
+++ mime.c 2012-03-23 18:36:39.777934029 +0000
+++ mime.c 2012-03-30 14:50:10.318065066 +0000
@@ -302,13 +302,78 @@ gettcharset(void)
return t;
}
@ -201,20 +201,22 @@
}
return convert;
}
@@ -989,8 +1103,12 @@ mime_fromhdr(struct str *in, struct str
@@ -989,8 +1103,14 @@ mime_fromhdr(struct str *in, struct str
#ifdef HAVE_ICONV
iconv_t fhicd = (iconv_t)-1;
#endif
+ encflags = 0;
+ enum mimeclean isclean = 0;
tcs = gettcharset();
+
+ encflags = 0;
+ if (has_highbit(in->s))
+ encflags |= MIME_HIGHBIT;
+ isclean |= (MIME_HIGHBIT|encflags);
+
maxstor = in->l;
out->s = smalloc(maxstor + 1);
out->l = 0;
@@ -1010,7 +1128,7 @@ mime_fromhdr(struct str *in, struct str
@@ -1010,7 +1130,7 @@ mime_fromhdr(struct str *in, struct str
#ifdef HAVE_ICONV
if (fhicd != (iconv_t)-1)
iconv_close(fhicd);
@ -223,16 +225,16 @@
fhicd = iconv_open_ft(tcs, cs);
else
fhicd = (iconv_t)-1;
@@ -1105,12 +1223,17 @@ notmime:
@@ -1105,12 +1225,17 @@ notmime:
}
fromhdr_end:
*q = '\0';
- if (flags & TD_ISPR) {
+ if ((flags & TD_ISPR) && (encflags & MIME_HIGHBIT)) {
+ if ((flags & TD_ISPR) && (isclean & MIME_HIGHBIT)) {
struct str new;
+ if ((encflags & MIME_UTF8) && asccasecmp("utf-8", tcs) == 0)
+ if ((isclean & MIME_UTF8) && asccasecmp("utf-8", tcs) == 0)
+ goto skip;
+ if ((encflags & MIME_LATIN) && ascncasecmp("iso-8859-", tcs, 9) == 0)
+ if ((isclean & MIME_LATIN) && ascncasecmp("iso-8859-", tcs, 9) == 0)
+ goto skip;
makeprint(out, &new);
free(out->s);