diff --git a/tests/system/shared/utils.py b/tests/system/shared/utils.py index 2a17e0333c2..8639c6e2651 100644 --- a/tests/system/shared/utils.py +++ b/tests/system/shared/utils.py @@ -611,8 +611,12 @@ def stringify(obj): if isinstance(obj, stringTypes): return obj if isinstance(obj, bytes): - tmp = obj.decode('cp1252') if platform.system() in ('Microsoft','Windows') else obj.decode() - return tmp + if not platform.system() in ('Microsoft', 'Windows'): + return obj.decode() + try: + return obj.decode('cp1252') + except UnicodeDecodeError: + return obj.decode('utf-8') class GitClone: diff --git a/tests/system/suite_editors/tst_edit_externally/test.py b/tests/system/suite_editors/tst_edit_externally/test.py index dea2f5d8ec6..e04ab19670a 100644 --- a/tests/system/suite_editors/tst_edit_externally/test.py +++ b/tests/system/suite_editors/tst_edit_externally/test.py @@ -39,7 +39,10 @@ def main(): test.fatal("Could not get the editor for '%s'" % currentFile, "Skipping this file for now.") continue + contentBefore = readFile(currentFile) + if not currentFile.endswith(".bin"): + contentBefore = stringify(contentBefore) if i % 2 == 0: # modify current file and store content for next modification formerContent = contentBefore