diff --git a/ethstaker_deposit/deposit.py b/ethstaker_deposit/deposit.py index 398312154..9f558a6e9 100644 --- a/ethstaker_deposit/deposit.py +++ b/ethstaker_deposit/deposit.py @@ -33,6 +33,19 @@ def check_python_version() -> None: sys.exit() +def check_term_encoding() -> None: + ''' + Checks that the terminal uses utf-8 encoding and exits if not. This is done to avoid issues with passwords + ''' + encoding = sys.stdin.encoding + if encoding not in ('utf-8', 'UTF-8'): + click.pause( + 'Your terminal is using %s encoding which can present problems with passwords. ' + 'Please use "utf-8".' % encoding + ) + sys.exit() + + def check_connectivity() -> None: ''' Checks if there is an internet connection and warns the user if so. @@ -109,6 +122,7 @@ def cli(ctx: click.Context, language: str, non_interactive: bool, ignore_connect def run() -> None: freeze_support() # Needed when running under Windows in a frozen bundle check_python_version() + check_term_encoding() try: cli()