UnicodeEncodeError in Python application

Andrew Clayton andrew at digital-domain.net
Thu Jan 5 20:41:03 UTC 2023


On Thu, 5 Jan 2023 17:01:01 +0100
Tobias Genannt <tobias.genannt at kappa-velorum.net> wrote:

> Hi Andrew,

Hi Tobias,

> > +    PyPreConfig_InitIsolatedConfig(&preconfig);
> > +    preconfig.utf8_mode = 1;

Could you check that setting preconfig.utf8_mode to -1 still works for
you?

This means that it will use the locale settings, specifically LC_CTYPE,
to determine whether to use UTF-8 or not.

It will use UTF-8 if LC_CTYPE is either: C, POSIX or some specific
UTF-8 locale, so looking at your list of locales it should be OK.

(You can either edit the patch and re-apply it, or just edit
src/python/nxt_python.c directly)

Cheers,
Andrew


More information about the unit mailing list