浏览代码

HPCC-10449 Unicode literals in embedded Python using wrong codepage

Need to tell Python that the source is utf8.

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 11 年之前
父节点
当前提交
c52af8b843
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      plugins/pyembed/pyembed.cpp

+ 2 - 1
plugins/pyembed/pyembed.cpp

@@ -331,7 +331,8 @@ public:
                 PyErr_Clear();
                 StringBuffer wrapped;
                 wrapPythonText(wrapped, text);
-                code.setown(Py_CompileString(wrapped, "<embed>", Py_file_input));
+                PyCompilerFlags flags = { PyCF_SOURCE_IS_UTF8 };
+                code.setown(Py_CompileStringFlags(wrapped, "<embed>", Py_file_input, &flags));
             }
             checkPythonError();
             if (code)