mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-09 04:25:38 +00:00
Bug 1404733 - Handle non-utf8 better in wpt logging, r=maja_zf
MozReview-Commit-ID: GMofBbKUtt0 --HG-- extra : rebase_source : 0caf26492e484032230824cbb20666577a6eeae7
This commit is contained in:
parent
6095257b3d
commit
7db492c796
@ -76,7 +76,10 @@ class LoggingWrapper(StringIO):
|
||||
|
||||
def write(self, data):
|
||||
if isinstance(data, str):
|
||||
data = data.decode("utf8")
|
||||
try:
|
||||
data = data.decode("utf8")
|
||||
except UnicodeDecodeError:
|
||||
data = data.encode("string_escape").decode("ascii")
|
||||
|
||||
if data.endswith("\n"):
|
||||
data = data[:-1]
|
||||
|
Loading…
x
Reference in New Issue
Block a user