Adding charset decoding to MIME.Message sounds good to me, perhaps with a flag to enable it on decoding? (A compat problem I can think of is that applications may assume that decoded data is 8bit strings and fail to apply proper encoding before writing to file, causing an exception.)
/Marty > 28 okt. 2016 kl. 17:20 skrev Chris Angelico <[email protected]>: > > Currently, Pike's MIME.Message parser doesn't handle non-ASCII headers > with specified encodings: > >> MIME.Message("Hello, world!", (["Subject": "Hello, \U0001F310"])); > (10) Result: Message(([ ])) >> (string)_; > (11) Result: "Subject: Hello, \U0001f310\r\n" > "Content-Length: 13\r\n" > "\r\n" > "Hello, world!" > > Going the other way: > >> MIME.Message("Subject: =?UTF-8?B?SGVsbG8sIPCfjJA=?=\r\n\r\nHello, world!"); > (13) Result: Message(([ ])) >> _->headers; > (14) Result: ([ /* 1 element */ > "subject": "=?UTF-8?B?SGVsbG8sIPCfjJA=?=" > ]) > > I'm currently working with IMAP and RFC[2]822 messages. I could either > implement RFC 2047 parsing in my app, or enhance MIME.Message to > return Unicode strings automatically. > > Would this functionality be welcomed in trunk? > > ChrisA
