[PATCH 0 of 6] mailutil: extension to handle non-ascii mail

Christian Ebert blacktrash at gmx.net
Sat Mar 8 10:01:48 CST 2008


Another proposal to improve handling non-ascii mail.
mailutil extension now works w/o import email.Charset.

Patch 6 addresses issue #814.

- be polite and able to spell recipients, senders correctly
- be ultra conservative with patches
- be flexible with remaining mail interaction and convert:
  - introductory messages
  - patch descriptions, when patch as attachment
  - notify

- introduce new email config, default (for western Europeans):

sendcharsets = iso-8859-1, iso-8859-15, windows-1252
# other examples:
# iso-8859-1, iso-8859-15, windows-1252, iso-8859-2, windows-1250
# iso-8859-1, iso-8859-15, windows-1252, iso-8859-2, windows-1250, iso-2022-jp, iso-2022-jp-ms

(idea stolen from Mutt)

us-ascii, utf-8 do not have to be included, are always checked.

For headers and message parts that can be converted w/o data
damage the mailutil.convert function cycles through sendcharsets
in descending order to try a successful conversion.

Both $HGENCODING and util._fallbackencoding are tried for input.

As last resort the conversion is done by util.tolocal.

Proposed as "hidden" extension to be used by other extensions so
the core is not clobbered.

Allow other utf charsets for patches?
How to handle patches containing 8-bit text and of course
changeset patches containing more than one charset. The cleanest
solution would probably be to send them as binary attachments
(application/x-patch ?).


More information about the Mercurial-devel mailing list