aboutsummaryrefslogtreecommitdiff
path: root/src/pl/plpython/plpy_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pl/plpython/plpy_util.c')
-rw-r--r--src/pl/plpython/plpy_util.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/pl/plpython/plpy_util.c b/src/pl/plpython/plpy_util.c
index 95cbba5cdc5..88670e66d0a 100644
--- a/src/pl/plpython/plpy_util.c
+++ b/src/pl/plpython/plpy_util.c
@@ -90,11 +90,9 @@ PLyUnicode_Bytes(PyObject *unicode)
{
PG_TRY();
{
- encoded = (char *) pg_do_encoding_conversion(
- (unsigned char *) utf8string,
- strlen(utf8string),
- PG_UTF8,
- GetDatabaseEncoding());
+ encoded = pg_any_to_server(utf8string,
+ strlen(utf8string),
+ PG_UTF8);
}
PG_CATCH();
{
@@ -109,7 +107,7 @@ PLyUnicode_Bytes(PyObject *unicode)
/* finally, build a bytes object in the server encoding */
rv = PyBytes_FromStringAndSize(encoded, strlen(encoded));
- /* if pg_do_encoding_conversion allocated memory, free it now */
+ /* if pg_any_to_server allocated memory, free it now */
if (utf8string != encoded)
pfree(encoded);
@@ -149,10 +147,7 @@ PLyUnicode_FromString(const char *s)
char *utf8string;
PyObject *o;
- utf8string = (char *) pg_do_encoding_conversion((unsigned char *) s,
- strlen(s),
- GetDatabaseEncoding(),
- PG_UTF8);
+ utf8string = pg_server_to_any(s, strlen(s), PG_UTF8);
o = PyUnicode_FromString(utf8string);