[Bf-blender-cvs] [43f7d5643f] master: Fix T50926: python crashes with path containing utf8 characters.

Bastien Montagne noreply at git.blender.org
Tue Mar 14 16:05:20 CET 2017


Commit: 43f7d5643ff20c50961c9e47ecc16ea79d811c94
Author: Bastien Montagne
Date:   Tue Mar 14 16:04:03 2017 +0100
Branches: master
https://developer.blender.org/rB43f7d5643ff20c50961c9e47ecc16ea79d811c94

Fix T50926: python crashes with path containing utf8 characters.

Default text encoding is platform-dependent in python, and windows
usually do not use utf-8 as default...

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

M	release/scripts/startup/bl_operators/presets.py

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

diff --git a/release/scripts/startup/bl_operators/presets.py b/release/scripts/startup/bl_operators/presets.py
index e01e509b29..cb332c1812 100644
--- a/release/scripts/startup/bl_operators/presets.py
+++ b/release/scripts/startup/bl_operators/presets.py
@@ -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"):




More information about the Bf-blender-cvs mailing list