D3953: mail: fix _encode to be more correct on Python 3
yuja (Yuya Nishihara)
phabricator at mercurial-scm.org
Sat Aug 11 22:17:16 EDT 2018
yuja added a comment.
>> def _encode(ui, s, charsets):
> > '''Returns (converted) string, charset tuple.
> > Finds out best charset by cycling through sendcharsets in descending
> > order. Tries both encoding and fallbackencoding for input. Only as
> > last resort send as is in fake ascii.
> > Caveat: Do not use for mail parts containing patches!'''
>
> Maybe this should be renamed `_encodelossy` to avoid surprises?
It isn't lossy in that any input bytes will never be dropped. If no reasonable
charset found, it falls back to 'us-ascii' to send bytes transparently.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D3953
To: durin42, #hg-reviewers, indygreg
Cc: yuja, indygreg, mercurial-devel
More information about the Mercurial-devel
mailing list