--- a/mercurial/mail.py Thu Oct 10 21:30:44 2019 +0200
+++ b/mercurial/mail.py Thu Oct 10 21:37:12 2019 +0200
@@ -145,10 +145,14 @@
sslutil.validatesocket(s.sock)
username = ui.config(b'smtp', b'username')
password = ui.config(b'smtp', b'password')
- if username and not password:
- password = ui.getpass()
+ if username:
+ if password:
+ password = encoding.strfromlocal(password)
+ else:
+ password = ui.getpass()
if username and password:
ui.note(_(b'(authenticating to mail server as %s)\n') % username)
+ username = encoding.strfromlocal(username)
try:
s.login(username, password)
except smtplib.SMTPException as inst: