Patchwork [5,of,5] mail: convert encoding.encoding to sysstr

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 12, 2018, 3:27 a.m.
Message ID <1c137e0a33afe4d7e613.1534044442@mimosa>
Download mbox | patch
Permalink /patch/33690/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 12, 2018, 3:27 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1534043768 -32400
#      Sun Aug 12 12:16:08 2018 +0900
# Node ID 1c137e0a33afe4d7e61325513d2518af8b93434a
# Parent  a160d88772ff1da51160faa5cfdbd7ecdbcd07fa
mail: convert encoding.encoding to sysstr
Augie Fackler - Aug. 13, 2018, 3:50 p.m.
> On Aug 11, 2018, at 11:27 PM, Yuya Nishihara <yuya@tcha.org> wrote:
> 
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1534043768 -32400
> #      Sun Aug 12 12:16:08 2018 +0900
> # Node ID 1c137e0a33afe4d7e61325513d2518af8b93434a
> # Parent  a160d88772ff1da51160faa5cfdbd7ecdbcd07fa
> mail: convert encoding.encoding to sysstr

queued, thanks

Patch

diff --git a/mercurial/mail.py b/mercurial/mail.py
--- a/mercurial/mail.py
+++ b/mercurial/mail.py
@@ -313,7 +313,7 @@  def _addressencode(ui, name, addr, chars
     try:
         acc, dom = addr.split('@')
         acc.decode('ascii')
-        dom = dom.decode(encoding.encoding).encode('idna')
+        dom = dom.decode(pycompat.sysstr(encoding.encoding)).encode('idna')
         addr = '%s@%s' % (acc, dom)
     except UnicodeDecodeError:
         raise error.Abort(_('invalid email address: %s') % addr)