summaryrefslogtreecommitdiff
path: root/psycopg/microprotocols.c
diff options
context:
space:
mode:
Diffstat (limited to 'psycopg/microprotocols.c')
-rw-r--r--psycopg/microprotocols.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/psycopg/microprotocols.c b/psycopg/microprotocols.c
index 7bd3374..3ddcc48 100644
--- a/psycopg/microprotocols.c
+++ b/psycopg/microprotocols.c
@@ -251,9 +251,7 @@ microprotocol_getquoted(PyObject *obj, connectionObject *conn)
/* Convert to bytes. */
if (res && PyUnicode_CheckExact(res)) {
PyObject *b;
- const char *pyenc;
- pyenc = (conn && conn->pyenc) ? conn->pyenc : "utf8";
- b = PyUnicode_AsEncodedString(res, pyenc, NULL);
+ b = conn_encode(conn, res);
Py_DECREF(res);
res = b;
}