[Xfce4-commits] <postler:master> We need to mask ?q?= before splitting since ?= is the separator
Christian Dywan
noreply at xfce.org
Thu Jul 29 12:26:12 CEST 2010
Updating branch refs/heads/master
to 3587dbc3436fef5723176aa4f382a32d43ecb3ad (commit)
from 3523951927da73d26be138ee7706a7570df14929 (commit)
commit 3587dbc3436fef5723176aa4f382a32d43ecb3ad
Author: Christian Dywan <christian at twotoasts.de>
Date: Tue Jul 27 16:26:42 2010 +0200
We need to mask ?q?= before splitting since ?= is the separator
postler/postler-messages.vala | 8 ++++++--
tests/parsing.vala | 1 +
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/postler/postler-messages.vala b/postler/postler-messages.vala
index d3431c0..4ce2e0e 100644
--- a/postler/postler-messages.vala
+++ b/postler/postler-messages.vala
@@ -289,13 +289,17 @@ public class Postler.Messages : Gtk.TreeView {
internal static string parse_encoded (string encoded, out string charset) {
/* format "=?charset?encoding?encoded?=",
if in doubt, bail out and take the raw data */
- string[] pieces = encoded.strip ().split ("?=");
+ /* We mask "?q?=" as "\nq\n=" here because ?= is our delimiter */
+ string eencoded = encoded.replace ("?q?=", "\nq\n=").replace ("?Q?=", "\nQ\n=");
+ string[] pieces = eencoded.strip ().split ("?=");
if (pieces == null || pieces[0] == null)
return encoded;
var decoded = new GLib.StringBuilder ();
- foreach (var piece in pieces)
+ foreach (string piece in pieces) {
+ piece = piece.replace ("\nq\n=", "?q?=").replace ("\nQ\n=", "?Q?=");
decoded.append (decode_piece (piece, out charset));
+ }
return decoded.str;
}
diff --git a/tests/parsing.vala b/tests/parsing.vala
index 3a1f6de..c90c905 100644
--- a/tests/parsing.vala
+++ b/tests/parsing.vala
@@ -106,6 +106,7 @@ void parsing_headers_mailer () {
const TestCase[] encodeds = {
{ "=?iso-8859-1?Q?Lila_L=F6ffel?=", "Lila Löffel" },
{ "=?iso-8859-15?q?S=FCddeutsche?=", "Süddeutsche" },
+ { "=?iso-8859-15?q?=FCddeutsche?=", "üddeutsche" },
{ "=?iso-8859-15?q?S=FCddeutsche_?==?iso-8859-15?q?W=FCrste?=",
"Süddeutsche Würste" },
{ "[Kritiker] =?iso-8859-15?q?S=FCddeutsche_?==?iso-8859-15?q?W=FCrste?=",
More information about the Xfce4-commits
mailing list