Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastián Barschkis <sebbas@sebbas.org>2020-01-23 19:12:19 +0300
committerSebastián Barschkis <sebbas@sebbas.org>2020-01-23 19:15:45 +0300
commit39ae4804a80fe96472d8f3c269825ec82eeb90f7 (patch)
treee408dfcfc58a188f9e181d4758c411ccfcf2e2d5 /extern/mantaflow/helper
parent517870a4a11f660c71d3901818fbb09798cb2d7d (diff)
Fix T72789: Mantaflow cache doesn't work with non-latin cache directory
Root of the problem was that Manta's Python API was converting to and from Latin1 instead of UTF8.
Diffstat (limited to 'extern/mantaflow/helper')
-rw-r--r--extern/mantaflow/helper/pwrapper/pconvert.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/extern/mantaflow/helper/pwrapper/pconvert.cpp b/extern/mantaflow/helper/pwrapper/pconvert.cpp
index c8c92cbf585..9ada75519fc 100644
--- a/extern/mantaflow/helper/pwrapper/pconvert.cpp
+++ b/extern/mantaflow/helper/pwrapper/pconvert.cpp
@@ -144,7 +144,12 @@ template<> int fromPy<int>(PyObject *obj)
template<> string fromPy<string>(PyObject *obj)
{
if (PyUnicode_Check(obj))
+#ifdef BLENDER
+ // Blender is completely UTF-8 based
+ return PyBytes_AsString(PyUnicode_AsUTF8String(obj));
+#else
return PyBytes_AsString(PyUnicode_AsLatin1String(obj));
+#endif
#if PY_MAJOR_VERSION <= 2
else if (PyString_Check(obj))
return PyString_AsString(obj);
@@ -155,7 +160,12 @@ template<> string fromPy<string>(PyObject *obj)
template<> const char *fromPy<const char *>(PyObject *obj)
{
if (PyUnicode_Check(obj))
+#ifdef BLENDER
+ // Blender is completely UTF-8 based
+ return PyBytes_AsString(PyUnicode_AsUTF8String(obj));
+#else
return PyBytes_AsString(PyUnicode_AsLatin1String(obj));
+#endif
#if PY_MAJOR_VERSION <= 2
else if (PyString_Check(obj))
return PyString_AsString(obj);