Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurice Raybaud <mauriceraybaud@hotmail.fr>2022-02-02 00:31:26 +0300
committerMaurice Raybaud <mauriceraybaud@hotmail.fr>2022-02-02 00:31:26 +0300
commit906e8c55eea5c30ab5c32a9045da39798c386c38 (patch)
tree03cbfa0db913e37e3a6bf049ee780c84fcb9e73c /render_povray
parentd0f7de2ce8bc95407df100c7f3d1e73d8dc9e0d0 (diff)
POV: Handle non utf-8 imports
* fix default open() encoding from strict system character set to utf-8 ignoring all other characters so Blender should no longer reject exotic input pov files as mostly user declared names will probably get changed in that process and likely everywhere the same way.
Diffstat (limited to 'render_povray')
-rwxr-xr-xrender_povray/scripting.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/render_povray/scripting.py b/render_povray/scripting.py
index 77e266ef..9499eb3d 100755
--- a/render_povray/scripting.py
+++ b/render_povray/scripting.py
@@ -153,7 +153,8 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
for file in self.files:
print("Importing file: " + file.name)
file_pov = self.directory + file.name
- for line in open(file_pov):
+ # Ignore any non unicode character
+ for line in open(file_pov, encoding='utf-8', errors='ignore'):
string = line.replace("{", " ")
string = string.replace("}", " ")
string = string.replace("<", " ")
@@ -184,7 +185,7 @@ class ImportPOV(bpy.types.Operator, ImportHelper):
]
matrixes[index] = value
write_matrix = False
- for line in open(file_pov):
+ for line in open(file_pov, encoding='utf-8', errors='ignore'):
S = line.replace("{", " { ")
S = S.replace("}", " } ")
S = S.replace(",", " ")