Revision: 41216
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41216
Author:   campbellbarton
Date:     2011-10-23 07:51:21 +0000 (Sun, 23 Oct 2011)
Log Message:
-----------
set pythons 'sys.stdout' encoding to utf-8 and use surrogateescape error 
handler.

without this printing a unicode string may raise an error which is a real pain 
especially since script authors often forget this and print the path of a file 
for example on export which can make a script fail outright when writing to 
paths with certain encodings.

Modified Paths:
--------------
    trunk/blender/source/blender/python/intern/bpy_interface.c

Modified: trunk/blender/source/blender/python/intern/bpy_interface.c
===================================================================
--- trunk/blender/source/blender/python/intern/bpy_interface.c  2011-10-23 
07:03:57 UTC (rev 41215)
+++ trunk/blender/source/blender/python/intern/bpy_interface.c  2011-10-23 
07:51:21 UTC (rev 41216)
@@ -203,6 +203,13 @@
        /* allow to use our own included python */
        PyC_SetHomePath(BLI_get_folder(BLENDER_SYSTEM_PYTHON, NULL));
 
+       /* without this the sys.stdout may be set to 'ascii'
+        * (it is on my system at least), where printing unicode values will 
raise
+        * an error, this is highly annoying, another stumbling block for devs,
+        * so use a more relaxed error handler and enforce utf-8 since the rest 
of
+        * blender is utf-8 too - campbell */
+       BLI_setenv("PYTHONIOENCODING", "utf-8:surrogateescape");
+
        /* Python 3.2 now looks for '2.xx/python/include/python3.2d/pyconfig.h' 
to
         * parse from the 'sysconfig' module which is used by 'site',
         * so for now disable site. alternatively we could copy the file. */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to