[Bf-extensions-cvs] [b7a4aa5] master: Fix T47310: WRML file not imported under OSX

Campbell Barton noreply at git.blender.org
Thu Feb 4 04:01:58 CET 2016


Commit: b7a4aa544884c9a2a1223657875f060ad53b7b1e
Author: Campbell Barton
Date:   Thu Feb 4 13:52:47 2016 +1100
Branches: master
https://developer.blender.org/rBAb7a4aa544884c9a2a1223657875f060ad53b7b1e

Fix T47310: WRML file not imported under OSX

Always use utf8 encoding, with error escaping

===================================================================

M	io_scene_x3d/import_x3d.py

===================================================================

diff --git a/io_scene_x3d/import_x3d.py b/io_scene_x3d/import_x3d.py
index 22f7ee4..d5494d6 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



More information about the Bf-extensions-cvs mailing list