mirror of
https://github.com/Threnklyn/esphome-dev.git
synced 2026-06-04 03:48:29 +02:00
Fix Non-ASCII characters being escaped if in wrong locale (#369)
This commit is contained in:
+5
-2
@@ -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):
|
||||||
|
|||||||
Reference in New Issue
Block a user