1
0
mirror of https://github.com/esphome/esphome.git synced 2025-07-15 03:23:22 +01:00

Fix Non-ASCII characters being escaped if in wrong locale ()

This commit is contained in:
Otto Winter
2019-01-19 16:48:16 +01:00
committed by GitHub
parent 0e7c247c0e
commit e54f05826c

@ -42,9 +42,12 @@ def safe_print(message=""):
pass pass
try: try:
print(message.encode('ascii', 'backslashreplace')) print(message.encode('utf-8', 'backslashreplace'))
except UnicodeEncodeError: except UnicodeEncodeError:
print("Cannot print line because of invalid locale!") try:
print(message.encode('ascii', 'backslashreplace'))
except UnicodeEncodeError:
print("Cannot print line because of invalid locale!")
def shlex_quote(s): def shlex_quote(s):