summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/App/ImapNotify.pm4
-rw-r--r--t/07_unicode.t9
2 files changed, 8 insertions, 5 deletions
diff --git a/lib/App/ImapNotify.pm b/lib/App/ImapNotify.pm
index 675d695..cbdc4ac 100644
--- a/lib/App/ImapNotify.pm
+++ b/lib/App/ImapNotify.pm
@@ -146,8 +146,8 @@ method _notify($message) {
next;
}
- if ($line =~ m/^\s+(.*)$/) {
- $fields->{$current_field} .= $1;
+ if ($line =~ m/^\s+(.*)\r$/) {
+ $fields->{$current_field} .= decode('MIME-Header', $1);
}
}
diff --git a/t/07_unicode.t b/t/07_unicode.t
index 57601d9..46a7a8d 100644
--- a/t/07_unicode.t
+++ b/t/07_unicode.t
@@ -23,10 +23,13 @@ $socket->set_series('readline',
"* 51 EXISTS\r\n",
"* 1 RECENT\r\n",
# this is a notification
- "* 51 FETCH (UID 41023 BODY[HEADER.FIELDS (FROM TO SUBJECT)] {".(36+24+59+2)."}\r\n",
+ "* 51 FETCH (UID 41023 BODY[HEADER.FIELDS (FROM TO SUBJECT)] {".(36+24+60+56+27+51+2)."}\r\n",
"From: <test\@localhost.localdomain>\r\n",
"To: <bluewind\@xinu.at>\r\n",
- "Subject: =?UTF-8?B?U29tZSDwn5KpIFTDg8K2c3Qgc3ViamVjdA==?=\r\n",
+ "Subject: =?ISO-8859-1?B?SWYgeW91IGNhbiByZWFkIHRoaXMgeW8=?=\r\n",
+ " =?ISO-8859-2?B?dSB1bmRlcnN0YW5kIHRoZSBleGFtcGxlLg==?=\r\n",
+ " =?US-ASCII?Q?.._cool! ?=\r\n",
+ " =?UTF-8?B?U29tZSDwn5KpIFTDg8K2c3Qgc3ViamVjdA==?=\r\n",
"\r\n",
")\r\n",
);
@@ -52,7 +55,7 @@ $app->loop();
is($socket->readline(), undef, "readline queue is read fully");
eq_or_diff($notifier->_calls(), [
- ['notify', [$notifier, 'From: <test@localhost.localdomain>', "Subject: Some \x{1F4A9} Töst subject"]]
+ ['notify', [$notifier, 'From: <test@localhost.localdomain>', "Subject: If you can read this you understand the example... cool! Some \x{1F4A9} Töst subject"]]
], "notifier is called correctly");
done_testing;