whiteout-io/mimefuncs — pull request #8 by asutherland (2014-11-20 15:33:02+00:00)
Title: fromTypedArray lives under mimefuncs, not mimefuncs.charset

For the Yandex IMAP server, for messages without a specific charset, the server
returns a charset of "X-UNKNOWN" which was causing the mimefuncs.charset.decode
function to end up in its catch() clause where "this.fromTypedArray" was
throwing.

There are arguably better things that can be done in the case of x-unknown like
trying as utf-8 and then an ISO-8859-x variant. Or just the iso-8859-x variant
first. (Roundcube used ISO-8859-15 for at least a while, see
http://trac.roundcube.net/changeset/38b012e0/github). But for this commit the
main point is just to properly call fromTypedArray per original intent.

Here's the example BODYSTRUCTURE for an example message:

```
("text" "plain" (CHARSET "X-UNKNOWN") NIL NIL "7bit" 29 1 NIL NIL NIL NIL)
```

Resulting from the following key headers:
```
Content-Transfer-Encoding: 7bit
Content-Type: text/plain
```

If creating a test Yandex account, be aware that the default message injected
into the INBOX is very minimal and the IMAP server produces a similar (but
completely incorrect) bodystructure. (The message is multipart/alternative
with a text/plain and text/html but is just reported as text/plain at the top
level.)