Hatuka*nezumi - IKEDA Soji writes:
Updated patch for 4.0.4. I splitted it to 4 subpatches.
# Changes on flowed format are removed. I wish more suggestions.
1) Small problem in encodebase64(). When generating multiple encoded words, they need to be separated by spaces. As it is, encodebase64() will generate "=?...?==?...?=" with no intervening space.
2) The logic in rfc2047_encode_callback that tries to avoid breaking up multibyte characters is hard to follow. I think there's a better approach.
First, convert the entire string to unicode. Then, take a small chunk of unicodes and convert it back to the original charset. If the result is larger than RFC2047_ENCODE_FOLDLENGTH, try again with a slightly smaller chunk. Encode it, then repeat until the entire unicode string is done.
If you know that, on average, the charset uses two octets per character then you can make a pretty good guess as to how many unicodes to try, each time.
pgpoSERf6YkMd.pgp
Description: PGP signature
