UnicodeEncodeError in Python application

Andrew Clayton andrew at digital-domain.net
Fri Dec 30 15:46:23 UTC 2022


On Thu, 22 Dec 2022 01:19:23 +0000
Andrew Clayton <andrew at digital-domain.net> wrote:

Hi Tobias,

> I may have some patches for you to test at some point...

You could try this simple test/debug patch to see if it fixes the issue

<patch>
diff --git a/src/python/nxt_python.c b/src/python/nxt_python.c
index bdb04579..0f9b373e 100644
--- a/src/python/nxt_python.c
+++ b/src/python/nxt_python.c
@@ -94,6 +94,8 @@ nxt_python3_init_config(nxt_int_t pep405)
         }
     }
 
+    PyConfig_SetString(&config, &config.filesystem_encoding, L"utf-8");
+
     status = Py_InitializeFromConfig(&config);
     if (PyStatus_Exception(status)) {
         goto pyinit_exception;
</patch>

You can also follow along @ https://github.com/nginx/unit/issues/817

Cheers,
Andrew


More information about the unit mailing list