UnicodeEncodeError in Python application

Tobias Genannt tobias.genannt at kappa-velorum.net
Fri Jan 6 09:04:11 UTC 2023


Hello Andrew,

setting preconfig.utf8_mode to -1 also works for my container. Locale is 
set like this:

LANG=C.utf8
LANGUAGE=
LC_CTYPE="C.utf8"
LC_NUMERIC="C.utf8"
LC_TIME="C.utf8"
LC_COLLATE="C.utf8"
LC_MONETARY="C.utf8"
LC_MESSAGES="C.utf8"
LC_PAPER="C.utf8"
LC_NAME="C.utf8"
LC_ADDRESS="C.utf8"
LC_TELEPHONE="C.utf8"
LC_MEASUREMENT="C.utf8"
LC_IDENTIFICATION="C.utf8"
LC_ALL=

Greetings,
Tobias

On 05/01/2023 21:41, Andrew Clayton wrote:
> 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