Hi all,

I ran into a strange issue regarding the encoding of the environment being 
passed to the Python3 script via

        def application(env, startResponse): […]

as it appears to be utf-8 encoded /twice/.  For testing, I added

        SetEnv X-Test ä

to the Apache config.  When I call a “traditional” Python3 CGI script, the 
value of os.environ['X-Test'] contains the UTF-8 encoded value as expected 
(i.e. the bytes 0xc3 0xa4).

However, in the script called via modwsgi

        WSGIScriptAlias /test /path/to/my/script.py

the value env['X-Test'] contains the bytes 0xc3 0x83 0xc2 0xa4, which is 
actually the value being regarded as ISO8859-1 (or similar), and then encoded 
to UTF-8 again.

My system:
* Debian Bullseye 64-Bit
* apache2 v. 2.4.54-1~deb11u1 (standard Debian package)
* libapache2-mod-wsgi-py3 v. 4.7.1-3 (standard Debian package)
* python3 v. 3.9.2-3 (standard Debian package)

I am pretty sure I just missed a crucial configuration setting, but I could not 
find which one…  Thus, any help to solve this issue would be highly appreciated!

Thanks in advance,
Albrecht.

--
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to modwsgi+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/modwsgi/2HM57NL5.5HNUHOW5.K3BMCLQD%40PTUKMMCY.UOWZU43L.FHHJJQFX.

Attachment: pgpfnibMxfw6p.pgp
Description: PGP signature

Reply via email to