Fix: Open GCODE files als utf-8, replacing encoding errors

Also detect files that contain a BOM and strip it.
Internal handling of GCODE file contents switched to unicode.

 Should take care of #1077
This commit is contained in:
Gina Häußge committed 2015-10-05 19:43:40 +02:00
1 parent abf073340f
commit 45c92cb1f4
3 files changed
+33 -7

No files matched your search

+3 -1
View File
@@ -35,7 +35,9 @@ class gcode(object):
if os.path.isfile(filename):
self.filename = filename
self._fileSize = os.stat(filename).st_size
with open(filename, "r") as f:
import codecs
with codecs.open(filename, encoding="utf-8", errors="replace") as f:
self._load(f, printer_profile, throttle=throttle)
def abort(self):