Displaying 5 results from an estimated 5 matches for "pyunicode_decodeutf8".
2014 Jan 15
0
[PATCH 3/4] hivex: python: Produce Unicode strings in get_* methods
...list (char * const * const argv)
list = PyList_New (argc);
for (i = 0; i < argc; ++i) {
-#ifdef HAVE_PYSTRING_ASSTRING
- PyList_SetItem (list, i, PyString_FromString (argv[i]));
-#else
- PyList_SetItem (list, i, PyUnicode_FromString (argv[i]));
-#endif
+ PyList_SetItem (list, i, PyUnicode_DecodeUTF8 (argv[i], strlen (argv[i]), NULL));
}
return list;
@@ -2985,11 +2981,7 @@ put_val_type (char *val, size_t len, hive_type t)
{
PyObject *r = PyTuple_New (2);
PyTuple_SetItem (r, 0, PyLong_FromLong ((long) t));
-#ifdef HAVE_PYSTRING_ASSTRING
- PyTuple_SetItem (r, 1, PyString_FromStrin...
2014 Jan 15
4
[PATCH 1/4] hivex: Python 2.6 does not have sysconfig.
---
configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 6785037..203f34f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -329,8 +329,8 @@ AS_IF([test "x$enable_python" != "xno"],
AC_MSG_CHECKING([for Python extension suffix (PEP-3149)])
if test -z "$PYTHON_EXT_SUFFIX"; then
2017 May 21
0
[PATCH 2/2] python: unicode decode handler error scheme setter
...*
guestfs_int_py_create (PyObject *self, PyObject *args)
{
guestfs_h *g;
@@ -386,7 +399,8 @@ guestfs_int_py_fromstring (const char *str)
#ifdef HAVE_PYSTRING_ASSTRING
return PyString_FromString (str);
#else
- return PyUnicode_FromString (str);
+ Py_ssize_t size = strlen(str);
+ return PyUnicode_DecodeUTF8 (str, size, decode_error_handler);
#endif
}
@@ -396,7 +410,7 @@ guestfs_int_py_fromstringsize (const char *str, size_t size)
#ifdef HAVE_PYSTRING_ASSTRING
return PyString_FromStringAndSize (str, size);
#else
- return PyUnicode_FromStringAndSize (str, size);
+ return PyUnicode_DecodeUTF8 (...
2014 Feb 03
1
[PATCH] hivex: python: value_value no longer generates Unicode strings
...enerator/generator.ml
index 908c5f3..02aaf12 100755
--- a/generator/generator.ml
+++ b/generator/generator.ml
@@ -2981,7 +2981,7 @@ put_val_type (char *val, size_t len, hive_type t)
{
PyObject *r = PyTuple_New (2);
PyTuple_SetItem (r, 0, PyLong_FromLong ((long) t));
- PyTuple_SetItem (r, 1, PyUnicode_DecodeUTF8 (val, len, NULL));
+ PyTuple_SetItem (r, 1, PyBytes_FromStringAndSize (val, len));
return r;
}
diff --git a/python/t/210-setvalue.py b/python/t/210-setvalue.py
index 2ee7ac5..8e7ed5c 100644
--- a/python/t/210-setvalue.py
+++ b/python/t/210-setvalue.py
@@ -19,6 +19,14 @@ import sys
import os...
2017 May 21
3
[PATCH 0/2] python: improved UTF8 decoding error handling
The Python 3 bindings currently are unable to deal with non UTF8 characters.
This series continues what proposed in RHBZ#1406906.
A new function 'set_decode_error_handler' allows the User to specify
how to deal with decoding errors.
The default behaviour will be raising a UnicodeDecodeError.
If the handler is changed to 'surrogateescape', non UTF8 characters will be escaped
in a