Skip to content

Commit c3252c1

Browse files
committed
Try permissive decoding to get it to work on Windows
1 parent 3a706ae commit c3252c1

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

atest/_libraries/logcheck.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from bs4 import UnicodeDammit
21
import time
32

43
def file_should_not_contain_phrases(filename, offset=0, *phrases):
@@ -9,14 +8,10 @@ def file_should_not_contain_phrases(filename, offset=0, *phrases):
98
text = None
109

1110
try:
12-
text = raw.decode("utf-8")
11+
text = raw.decode("utf-8", errors='replace')
1312
except Exception as err:
14-
print("Failed to read", filename, "forcing unicode...\n", err)
15-
try:
16-
text = UnicodeDammit.detwingle(raw).decode("utf-8")
17-
except Exception as err:
18-
print("Failed to read", filename, "giving up...\n", err)
19-
text = None
13+
print("Failed to read", filename, "giving up...\n", err)
14+
text = None
2015

2116
matches = {}
2217

0 commit comments

Comments
 (0)