{"id":4305,"date":"2013-09-27T18:39:12","date_gmt":"2013-09-27T16:39:12","guid":{"rendered":"http:\/\/www.limilabs.com\/blog\/?p=4305"},"modified":"2014-04-15T14:22:52","modified_gmt":"2014-04-15T12:22:52","slug":"outlook-com-imap-national-characters-envelope-bug","status":"publish","type":"post","link":"https:\/\/www.limilabs.com\/blog\/outlook-com-imap-national-characters-envelope-bug","title":{"rendered":"Outlook.com IMAP national characters ENVELOPE bug"},"content":{"rendered":"<h2>Summary<\/h2>\n<p>Outlook.com IMAP implementation does not work correctly with messages containing national characters. ENVELOPE retrieved for a message, that has national characters in the subject (correctly encoded using Base64), has &#8216;?&#8217; characters instead of encoded characters.<\/p>\n<p>Actual:<br \/>\n<code>ENVELOPE (\"Fri, 27 Sep 2013 17:59:48 +0200\" \"<strong>za????<\/strong>\"<\/code><\/p>\n<p>Expected:<br \/>\n<code>ENVELOPE (\"Fri, 27 Sep 2013 18:23:23 +0200\" \"=?utf-8?B?emHFvMOzxYLEhw==?=\" ...<\/code><br \/>\n-or-<br \/>\n<code>ENVELOPE (\"Fri, 27 Sep 2013 18:21:17 +0200\" \"=?ISO-8859-2?B?emG\/87Pm?=\" ...<\/code><\/p>\n<h2>Logs<\/h2>\n<p><code>Mail.dll C: 6d9d6c00b9294efb APPEND Inbox (\\SEEN) {243}<br \/>\nMail.dll S: + Ready<br \/>\nMail.dll C: Content-Type: text\/plain;<br \/>\n charset=\"utf-8\"<br \/>\nContent-Transfer-Encoding: 7bit<br \/>\nMIME-Version: 1.0<br \/>\nSubject: =?utf-8?B?emHFvMOzxYLEhw==?=<br \/>\nMessage-ID: <a0000011-dab4-4cb4-9cf4-d4afdd05b706@mail.dll><br \/>\nDate: Fri, 27 Sep 2013 17:59:48 +0200<\/p>\n<p>Hello<br \/>\nMail.dll S: 6d9d6c00b9294efb OK APPEND completed<br \/>\nMail.dll C: 0a55ca5702664b94 UID FETCH 100065 (UID RFC822.SIZE INTERNALDATE FLAGS ENVELOPE BODYSTRUCTURE)<br \/>\nMail.dll S: * 3 FETCH (UID 100065 RFC822.SIZE 290 FLAGS (\\Seen) INTERNALDATE \"27-Sep-2013 15:59:44 +0000\" ENVELOPE (\"Fri, 27 Sep 2013 17:59:48 +0200\" \"<strong>za????<\/strong>\" NIL NIL NIL NIL NIL NIL NIL \"<a0000011-dab4-4cb4-9cf4-d4afdd05b706@mail.dll>\") BODYSTRUCTURE (\"TEXT\" \"plain\" (\"charset\" \"utf-8\") NIL NIL \"7BIT\" 5 1 NIL NIL NIL NIL))<br \/>\nMail.dll S: 0a55ca5702664b94 OK FETCH Completed<br \/>\n<\/code><\/p>\n<h2>Workaround<\/h2>\n<p>You can workaround this issue, requesting subject header explicitly or downloading all headers (using <em>GetHeadersByUID<\/em>):<\/p>\n<pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\r\nvar eml = client.GetSpecificHeadersByUID(uploaded, new&#x5B;]{&quot;subject&quot;}).EmlData;\r\nstring subject = new MailBuilder().CreateFromEml(eml).Subject;\r\n<\/pre>\n<p>Although slower, correct data is returned:<\/p>\n<p><code><br \/>\n66496df367914917 UID FETCH 100078 (UID BODY[HEADER.FIELDS (SUBJECT)])<br \/>\nMail.dll: 13 19:38:29 S: * 7 FETCH (UID 100078 BODY[HEADER.FIELDS (\"SUBJECT\")] {41}<br \/>\nMail.dll: 13 19:38:30 S: Subject: =?utf-8?B?emHFvMOzxYLEhw==?=<\/p>\n<p>Mail.dll: 13 19:38:30 S: )<br \/>\nMail.dll: 13 19:38:30 S: 66496df367914917 OK FETCH Completed<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary Outlook.com IMAP implementation does not work correctly with messages containing national characters. ENVELOPE retrieved for a message, that has national characters in the subject (correctly encoded using Base64), has &#8216;?&#8217; characters instead of encoded characters. Actual: ENVELOPE (&#8220;Fri, 27 Sep 2013 17:59:48 +0200&#8221; &#8220;za????&#8221; Expected: ENVELOPE (&#8220;Fri, 27 Sep 2013 18:23:23 +0200&#8221; &#8220;=?utf-8?B?emHFvMOzxYLEhw==?=&#8221; &#8230; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[98,28,92],"class_list":["post-4305","post","type-post","status-publish","format-standard","hentry","category-news","tag-bug","tag-imap","tag-outlook-com"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/4305"}],"collection":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/comments?post=4305"}],"version-history":[{"count":15,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/4305\/revisions"}],"predecessor-version":[{"id":4312,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/posts\/4305\/revisions\/4312"}],"wp:attachment":[{"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/media?parent=4305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/categories?post=4305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.limilabs.com\/blog\/wp-json\/wp\/v2\/tags?post=4305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}