diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -3792,6 +3792,10 @@ 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 @@ 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 @@ -1741,7 +1741,7 @@ raise EOFError return l.rstrip(b'\n') else: - return getpass.getpass('') + return encoding.strtolocal(getpass.getpass('')) except EOFError: raise error.ResponseExpected()