Fix T50926: python crashes with path containing utf8 characters.
authorBastien Montagne <montagne29@wanadoo.fr>
Tue, 14 Mar 2017 15:04:03 +0000 (16:04 +0100)
committerBastien Montagne <montagne29@wanadoo.fr>
Tue, 14 Mar 2017 15:04:45 +0000 (16:04 +0100)
Default text encoding is platform-dependent in python, and windows
usually do not use utf-8 as default...

release/scripts/startup/bl_operators/presets.py

index e01e509b2927db1c12c07a85b4a56351521a983c..cb332c181274de4670895a2231263b3794581f64 100644 (file)
@@ -135,7 +135,7 @@ class AddPresetBase:
 
                             file_preset.write("%s = %r\n" % (rna_path_step, value))
 
-                    file_preset = open(filepath, 'w')
+                    file_preset = open(filepath, 'w', encoding="utf-8")
                     file_preset.write("import bpy\n")
 
                     if hasattr(self, "preset_defines"):