summaryrefslogtreecommitdiff
path: root/mail/sylpheed-gtk2/files/patch-encoding
blob: 3522a934e5878aabefebd3d492acb5c0cc69560f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--- src/procmime.c.orig	Thu Oct 21 17:25:19 2004
+++ src/procmime.c	Thu Oct 21 18:12:24 2004
@@ -694,7 +694,7 @@
 	if (mimeinfo->mime_type == MIME_TEXT) {
 		while (fgets(buf, sizeof(buf), tmpfp) != NULL) {
 #warning FIXME_GTK2
-			str = conv_codeset_strdup(buf, src_codeset, NULL);
+			str = conv_codeset_strdup(buf, src_codeset, CS_UTF_8);
 			if (str) {
 				fputs(str, outfp);
 				g_free(str);
--- src/unmime.c.orig	Thu Oct 21 17:25:20 2004
+++ src/unmime.c	Thu Oct 21 17:37:45 2004
@@ -113,7 +113,7 @@
 		}
 
 		/* convert to locale encoding */
-		conv_str = conv_codeset_strdup(decoded_text, charset, NULL);
+		conv_str = conv_codeset_strdup(decoded_text, charset, CS_UTF_8);
 		if (conv_str) {
 			len = strlen(conv_str);
 			memcpy(outp, conv_str, len);
--- src/codeconv.c.orig	Thu Oct 21 22:08:15 2004
+++ src/codeconv.c	Thu Oct 21 22:08:34 2004
@@ -1651,8 +1651,20 @@
 		Xalloca(buf, buflen, return);
 		conv_anytodisp(buf, buflen, str);
 		unmime_header(outbuf, buf);
-	} else
+	} else {
+		gchar *tmp;
 		unmime_header(outbuf, str);
+		if (outbuf && !g_utf8_validate(outbuf, -1, NULL)) {
+			tmp = conv_codeset_strdup(outbuf,
+					conv_get_current_charset_str(),
+					CS_UTF_8);
+			if (tmp) {
+				strncpy(outbuf, tmp, outlen-1);
+				g_free(tmp);
+			}
+		}
+	}
+
 }
 
 #define MAX_LINELEN		76