diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -3787,6 +3787,10 @@ def debugtemplate(ui, repo, tmpl, **opts def debuguigetpass(ui, prompt=b''): """show prompt to type password""" r = ui.getpass(prompt) + if r is not None: + r = encoding.strtolocal(r) + else: + r = b"" ui.writenoi18n(b'response: %s\n' % r) diff --git a/mercurial/mail.py b/mercurial/mail.py --- a/mercurial/mail.py +++ b/mercurial/mail.py @@ -157,6 +157,8 @@ def _smtp(ui): password = encoding.strfromlocal(password) else: password = ui.getpass() + if password is not None: + password = encoding.strfromlocal(password) if username and password: ui.note(_(b'(authenticating to mail server as %s)\n') % username) username = encoding.strfromlocal(username) diff --git a/mercurial/ui.py b/mercurial/ui.py --- a/mercurial/ui.py +++ b/mercurial/ui.py @@ -1735,7 +1735,7 @@ class ui(object): raise EOFError return l.rstrip(b'\n') else: - return getpass.getpass('') + return encoding.strtolocal(getpass.getpass('')) except EOFError: raise error.ResponseExpected()