Displaying 2 results from an estimated 2 matches for "52c36f1d2".
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
2017 May 21
0
[PATCH 2/2] python: unicode decode handler error scheme setter
...urn the previous error handler.
+ \"\"\"
+ return libguestfsmod.set_decode_error_handler(handler)
+
+
class GuestFS(object):
\"\"\"Instances of this class are libguestfs API handles.\"\"\"
diff --git a/python/handle.c b/python/handle.c
index 52c36f1d2..b665bb899 100644
--- a/python/handle.c
+++ b/python/handle.c
@@ -35,6 +35,8 @@
#include "actions.h"
+static const char *decode_error_handler = "strict";
+
static PyObject **get_all_event_callbacks (guestfs_h *g, size_t *len_rtn);
void
@@ -45,6 +47,17 @@ guestfs_int_py_ext...