Add workaround for invalid message charset detection by IMAP servers (#1488968)