[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31655] trunk/blender/source/blender/ python/generic/bpy_internal_import.c: bugfix [#23197] Python can' t handle German umlaut characters in strings

Campbell Barton ideasman42 at gmail.com
Mon Aug 30 10:23:51 CEST 2010


Revision: 31655
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31655
Author:   campbellbarton
Date:     2010-08-30 10:23:48 +0200 (Mon, 30 Aug 2010)

Log Message:
-----------
bugfix [#23197] Python can't handle German umlaut characters in strings
workaround for python bug with Py_CompileString(), reported http://bugs.python.org/msg115202

Modified Paths:
--------------
    trunk/blender/source/blender/python/generic/bpy_internal_import.c

Modified: trunk/blender/source/blender/python/generic/bpy_internal_import.c
===================================================================
--- trunk/blender/source/blender/python/generic/bpy_internal_import.c	2010-08-30 07:15:54 UTC (rev 31654)
+++ trunk/blender/source/blender/python/generic/bpy_internal_import.c	2010-08-30 08:23:48 UTC (rev 31655)
@@ -35,6 +35,7 @@
 #include "BKE_global.h" /* grr, only for G.sce */
 #include "BLI_listbase.h"
 #include "BLI_path_util.h"
+#include "BLI_string.h"
 #include <stddef.h>
 
 static Main *bpy_import_main= NULL;
@@ -61,6 +62,12 @@
 void bpy_text_filename_get(char *fn, Text *text)
 {
 	sprintf(fn, "%s/%s", text->id.lib ? text->id.lib->filepath : G.sce, text->id.name+2);
+	
+	/* XXX, this is a bug in python's Py_CompileString()!
+	 the string encoding should not be required to be utf-8
+	 reported: http://bugs.python.org/msg115202
+	 */
+	BLI_utf8_invalid_strip(fn, strlen(fn));
 }
 
 PyObject *bpy_text_import( Text *text )





More information about the Bf-blender-cvs mailing list