summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenri Sivonen <hsivonen@hsivonen.fi>2018-11-17 20:41:28 +0200
committerKartikaya Gupta (kats) <staktrace@users.noreply.github.com>2019-05-23 21:40:49 -0400
commit8d410d9af3db7f8ddf0634bb65d1a6aa96f31e10 (patch)
tree36a957e9dd3d553fc2bfd0f4db510c0f98c85580
parenta60c8493d3c921ab3e87646866fd3fdd0ee03cb6 (diff)
downloadmailparse-8d410d9af3db7f8ddf0634bb65d1a6aa96f31e10.tar.gz
mailparse-8d410d9af3db7f8ddf0634bb65d1a6aa96f31e10.tar.xz
Test ISO-2022-JP in headers
-rw-r--r--src/lib.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib.rs b/src/lib.rs
index f707a99..a42dae9 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -945,6 +945,22 @@ mod tests {
"[Ontario Builder] Understanding home shopping \u{2013} a quick survey"
);
+ let (parsed, _) = parse_header(b"Subject: =?ISO-2022-JP?B?GyRCRnwbKEI=?=\n\t=?ISO-2022-JP?B?GyRCS1wbKEI=?=\n\t=?ISO-2022-JP?B?GyRCOGwbKEI=?=")
+ .unwrap();
+ assert_eq!(parsed.get_key().unwrap(), "Subject");
+ assert_eq!(
+ parsed.get_value().unwrap(),
+ "\u{65E5}\u{672C}\u{8A9E}"
+ );
+
+ let (parsed, _) = parse_header(b"Subject: =?ISO-2022-JP?Q?=1B\x24\x42\x46\x7C=1B\x28\x42?=\n\t=?ISO-2022-JP?Q?=1B\x24\x42\x4B\x5C=1B\x28\x42?=\n\t=?ISO-2022-JP?Q?=1B\x24\x42\x38\x6C=1B\x28\x42?=")
+ .unwrap();
+ assert_eq!(parsed.get_key().unwrap(), "Subject");
+ assert_eq!(
+ parsed.get_value().unwrap(),
+ "\u{65E5}\u{672C}\u{8A9E}"
+ );
+
let (parsed, _) = parse_header(
b"Content-Type: image/jpeg; name=\"=?UTF-8?B?MDY2MTM5ODEuanBn?=\"",
).unwrap();