From b7a4aa544884c9a2a1223657875f060ad53b7b1e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 4 Feb 2016 13:52:47 +1100 Subject: [PATCH] Fix T47310: WRML file not imported under OSX Always use utf8 encoding, with error escaping --- io_scene_x3d/import_x3d.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/io_scene_x3d/import_x3d.py b/io_scene_x3d/import_x3d.py index 22f7ee47..d5494d6b 100644 --- a/io_scene_x3d/import_x3d.py +++ b/io_scene_x3d/import_x3d.py @@ -1266,13 +1266,14 @@ def gzipOpen(path): if data is None: try: - filehandle = open(path, 'rU') + filehandle = open(path, 'rU', encoding='utf-8', errors='surrogateescape') data = filehandle.read() filehandle.close() except: - pass + import traceback + traceback.print_exc() else: - data = data.decode('utf-8', "replace") + data = data.decode(encoding='utf-8', errors='surrogateescape') return data -- 2.11.4.GIT