From e368a82e8f162de1aebe71b624dcb015589ab540 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Wed, 20 Nov 2019 16:23:23 +0100 Subject: [PATCH] Force utf-8 instead of ascii in psn-account-id.py #103 --- scripts/psn-account-id.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/psn-account-id.py b/scripts/psn-account-id.py index 5c50cb7..63c0af8 100755 --- a/scripts/psn-account-id.py +++ b/scripts/psn-account-id.py @@ -6,6 +6,11 @@ if sys.version_info < (3, 0, 0): print("DO NOT use Python 2.\nEVER.\nhttps://pythonclock.org") exit(1) +if sys.stdout.encoding.lower() == "ascii": + import codecs + sys.stdout = codecs.getwriter('utf-8')(sys.stdout.buffer) + sys.stderr = codecs.getwriter('utf-8')(sys.stderr.buffer) + try: import requests except ImportError as e: