I've the following setup: Django: 4.0.5 Python: 3.9.2 Debian: 11.1 Apache2: 2.4.53-1~deb11u1 libapache2-mod-wsgi-py3: 4.7.1-3+b1 mariadb-server-10.5: 1:10.5.15-0+deb11u1 .
When I run my application from the development server (same virtualenv, same code), it runs without any error, but when I run the same via apache2, it throws some kind of encoding error here:
strx = 'sth %s' % name
f = open('/tmp/somerandomfile', 'w')
f.write(strx)
. The name variable is coming from the database and contains a national character.
When I print it via the development server and apache2, I got these:
#development server - to the console
print(strx, type(strx))
Kiadások <class 'str'>
#apache2 - to the apache log file
print(strx, type(strx))
Kiad\xc3\xa1sok <class 'str'>
. So it seems the 2 str differs in encoding.
To fix it's easy, however, I'm rather interested why do I get a different result via the development server and apache2? How can I set it to have the same result.
As mentioned, I'm using wsgi.
Any idea where I could check for differences? And how could I have the exact same behaviour on Apache2 serving according to the django development server?
Thanks.