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.
This commit is contained in:
parent
d0f7de2ce8
commit
906e8c55ee
|
@ -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(",", " ")
|
||||
|
|
Loading…
Reference in New Issue