Open i0xHeX opened 5 years ago
Hi.
Same issue in assemble.py also.
Think it can be fixed in this pr too.
My Drive
Index: assemble.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/assemble.py b/assemble.py
--- a/assemble.py (revision 379f37795c127820c0212929dfdab449fb06c55e)
+++ b/assemble.py (date 1633001555741)
@@ -13,8 +13,12 @@
def assembleClass(filename):
basename = os.path.basename(filename)
- with open(filename, 'rU') as f:
- source = f.read()
+ try:
+ with open(filename, 'rU') as f:
+ source = f.read()
+ except Exception:
+ with open(filename, 'rU', encoding='utf8') as f:
+ source = f.read()
return assembleSource(source, basename)
if __name__== "__main__":
Index: Krakatau/script_util.py
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/Krakatau/script_util.py b/Krakatau/script_util.py
--- a/Krakatau/script_util.py (revision 379f37795c127820c0212929dfdab449fb06c55e)
+++ b/Krakatau/script_util.py (date 1633001555757)
@@ -148,8 +148,12 @@
raise
mode = 'wb' if isinstance(data, bytes) else 'w'
- with open(out, mode) as f:
- f.write(data)
+ try:
+ with open(out, mode) as f:
+ f.write(data)
+ except Exception:
+ with open(out, mode, encoding='utf8') as f:
+ f.write(data)
return out
def __enter__(self): return self
Fix for issue #142