We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 425ed7a commit f925981Copy full SHA for f925981
engines/wintermute/decompile_script.py
@@ -39,6 +39,14 @@
39
import sys
40
import traceback
41
42
+def safe_decode(b):
43
+ for enc in ("cp1252", "latin-1", "utf-8"):
44
+ try:
45
+ return b.decode(enc)
46
+ except UnicodeDecodeError:
47
+ continue
48
+ return b.decode("latin-1", errors="replace")
49
+
50
if len(sys.argv) == 1 or len(sys.argv) > 3:
51
print("Usage: %s <path-to-compiled-script> [<path-to-inc-folder>]")
52
sys.exit(-1)
@@ -157,7 +165,7 @@ def read_string(self):
157
165
return result
158
166
159
167
def read_header(self):
160
- self.fname = self.data[32:self.offsets[2]].strip().decode("utf-8")
168
+ self.fname = safe_decode(self.data[32:self.offsets[2]].strip())
161
169
self.tables = {}
162
170
self.externals = []
163
171
for i,title in enumerate(self.table_names):
0 commit comments