summarylogtreecommitdiffstats
path: root/0001-Avoid-non-UTF-8-code.patch
blob: b0678b73d15b079f956866da2734842bb9c47a2b (plain)
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
From 864f03034d9af34386cd854d105c9bddbc06ab3a Mon Sep 17 00:00:00 2001
Message-Id: <864f03034d9af34386cd854d105c9bddbc06ab3a.1511519809.git.jan.steffens@gmail.com>
From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
Date: Fri, 24 Nov 2017 11:36:33 +0100
Subject: [PATCH] Avoid non-UTF-8 code

---
 gmime/gmime-filter-charset.c |  4 ++--
 gmime/gmime-iconv-utils.c    |  4 ++--
 tests/test-iconv.c           | 48 ++++++++++++++++++++++----------------------
 3 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/gmime/gmime-filter-charset.c b/gmime/gmime-filter-charset.c
index 052268e15c519af0..023823cf8a1251e9 100644
--- a/gmime/gmime-filter-charset.c
+++ b/gmime/gmime-filter-charset.c
@@ -243,8 +243,8 @@ filter_complete (GMimeFilter *filter, char *in, size_t len, size_t prespace,
 				inleft--;
 			} else if (errno == EINVAL) {
 				/*
-				 * EINVAL  An  incomplete  multibyte sequence has been encoun
-				 *         tered in the input.
+				 * EINVAL  An  incomplete  multibyte sequence has been
+				 *         encountered in the input.
 				 *
 				 * We assume that this can only happen if we've run out of
 				 * bytes for a multibyte sequence, if not we're in trouble.
diff --git a/gmime/gmime-iconv-utils.c b/gmime/gmime-iconv-utils.c
index 94ddf36e2554493e..a6a874e8218c08f6 100644
--- a/gmime/gmime-iconv-utils.c
+++ b/gmime/gmime-iconv-utils.c
@@ -132,8 +132,8 @@ g_mime_iconv_strndup (iconv_t cd, const char *str, size_t n)
 		converted = iconv (cd, (char **) &inbuf, &inleft, &outbuf, &outleft);
 		if (converted != (size_t) -1 || errno == EINVAL) {
 			/*
-			 * EINVAL  An  incomplete  multibyte sequence has been encoun
-			 *         tered in the input.
+			 * EINVAL  An  incomplete  multibyte sequence has been
+			 *         encountered in the input.
 			 *
 			 * We'll just have to ignore it...
 			 */
diff --git a/tests/test-iconv.c b/tests/test-iconv.c
index c1eaab821963f703..8f04f918c8a73925 100644
--- a/tests/test-iconv.c
+++ b/tests/test-iconv.c
@@ -111,36 +111,36 @@ struct {
 	const char *charset;
 } tests[] = {
 	{ "Ətraflı", "utf-8" },                /* az */
-	{ " ", "windows-cp1251" },      /* bg */
-	{ "Cnjuge", "iso-8859-1" },                /* ca */
-	{ "Avanceret sgning", "iso-8859-1" },      /* da */
-	{ "Lschen", "iso-8859-1" },                /* de */
+	{ "\xc4\xee\xe1\xe0\xe2\xe8 \xd3\xf1\xeb\xf3\xe3\xe0", "windows-cp1251" },      /* bg */
+	{ "C\xf2njuge", "iso-8859-1" },                /* ca */
+	{ "Avanceret s\xf8gning", "iso-8859-1" },      /* da */
+	{ "L\xf6schen", "iso-8859-1" },                /* de */
 	{ "some text", "iso-8859-1" },              /* en */
-	{ "piv", "iso-8859-15" },                /* fi */
-	{ "Modifi", "iso-8859-1" },                /* fr */
-	{ "Tidal", "iso-8859-1" },                 /* ga */
-	{ "Fbrica", "iso-8859-1" },                /* gl */
-	{ "Szem-Blyhv-A ", "iso-8859-2" },            /* hu */
-	{ "Non c' corrispondenza", "iso-8859-1" }, /* it */
-	{ "$(B>e5i8!:w(B", "euc-jp" },                   /* ja */
-	{ "$(C0m1^(B $(C0K;v(B", "euc-kr" },                  /* ko */
-	{ "Isami paieka", "iso-8859-13" },        /* lt */
-	{ "Paplaint Meklana", "iso-8859-13" }, /* lv */
-	{ "Kopiren", "iso-8859-15" },              /* nl */
-	{ "ydelagd Sk", "iso-8859-1" },           /* nn */
-	{ "Avansert sk", "iso-8859-1" },           /* no */
-	{ "-Brda-A ksi-Bki-A adresowej", "iso-8859-2" }, /* pl */
-	{ "C-Butare-A avansat-B-A ", "iso-8859-2" },      /* ro */
-	{ "-L-A -L-A ", "koi8-r" },         /* ru */
+	{ "p\xe4iv\xe4\xe4", "iso-8859-15" },                /* fi */
+	{ "Modifi\xe9", "iso-8859-1" },                /* fr */
+	{ "Tid\xe9al", "iso-8859-1" },                 /* ga */
+	{ "F\xe1brica", "iso-8859-1" },                /* gl */
+	{ "Szem\x1b-B\xe9lyh\xedv\xf3\x1b-A ", "iso-8859-2" },            /* hu */
+	{ "Non c'\xe9 corrispondenza", "iso-8859-1" }, /* it */
+	{ "\x1b$(B>e5i8!:w\x1b(B", "euc-jp" },                   /* ja */
+	{ "\x1b$(C0m1^\x1b(B \x1b$(C0K;v\x1b(B", "euc-kr" },                  /* ko */
+	{ "I\xf0sami paie\xf0ka", "iso-8859-13" },        /* lt */
+	{ "Papla\xf0in\xe2t\xe2 Mekl\xe7\xf0ana", "iso-8859-13" }, /* lv */
+	{ "Kopi\xebren", "iso-8859-15" },              /* nl */
+	{ "\xd8ydelagd S\xf8k", "iso-8859-1" },           /* nn */
+	{ "Avansert s\xf8k", "iso-8859-1" },           /* no */
+	{ "\x1b-B\xacr\xf3d\xb3a\x1b-A ksi\x1b-B\xb1\xbfki\x1b-A adresowej", "iso-8859-2" }, /* pl */
+	{ "C\x1b-B\xe3utare\x1b-A avansat\x1b-B\xe3\x1b-A ", "iso-8859-2" },      /* ro */
+	{ "\x1b-L\xc0\xd0\xe1\xe8\xd8\xe0\xd5\xdd\xdd\xeb\xd9\x1b-A \x1b-L\xdf\xde\xd8\xe1\xda\x1b-A ", "koi8-r" },         /* ru */
 	{ "Pokročilé hľadanie", "utf-8" },    /* sk */
 	{ "Ga želite", "utf-8" },                  /* sl */
-	{ "den nd?", "iso-8859-1" },              /* sv */
-	{ "Geli-Mmi-A Arama", "iso-8859-9" },         /* tr */
-	{ " ", "koi8-u" },        /* uk */
+	{ "den \xe4nd\xe5?", "iso-8859-1" },              /* sv */
+	{ "Geli\x1b-M\xfemi\xfe\x1b-A Arama", "iso-8859-9" },         /* tr */
+	{ "\xf5\xc4\xcf\xd3\xcb\xcf\xce\xc1\xcc\xc5\xce\xc9\xca \xd0\xcf\xdb\xd5\xcb", "koi8-u" },        /* uk */
 	
 #if 0
 	/* this is expected to fail */
-	{ "ɚ尋(I>(B", "utf-8" },         /* zh_TW */
+	{ "\xe9\x92\xc9\x9a\x8e\xe5\xb0\x8b\xe6\x1b(I>\x1b(B", "utf-8" },         /* zh_TW */
 #endif
 };
 
-- 
2.15.0