Another attempt to fix VNese bugs with utf-8.
This commit is contained in:
parent
d8e514911a
commit
dd725466e5
1 changed files with 10 additions and 1 deletions
|
@ -139,7 +139,16 @@ def group_test_cases(cases):
|
|||
|
||||
def read_head_archive(archive, file):
|
||||
with archive.open(file) as f:
|
||||
return f.read(settings.TESTCASE_VISIBLE_LENGTH + 3)
|
||||
s = f.read(settings.TESTCASE_VISIBLE_LENGTH + 3)
|
||||
# add this so there are no characters left behind (ex, 'á' = 2 utf-8 chars)
|
||||
while True:
|
||||
try:
|
||||
s.decode('utf-8')
|
||||
break
|
||||
except UnicodeDecodeError:
|
||||
s += f.read(1)
|
||||
return s
|
||||
|
||||
|
||||
def get_visible_content(data):
|
||||
data = data or b''
|
||||
|
|
Loading…
Reference in a new issue