I'm running Ubuntu 14.04 server with Django + Gunicorn + Nginx.
Nginx config contains line for utf-8 charset.
Locale output for user "auction" (this user runs the server):
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL=en_US.utf8
Filesystem encoding for this user:
sys.getfilesystemencoding()
'UTF-8'
But when I'm calling the same method in the view, it returns 'ANSI_X3.4-1968'.
So, I can not upload the files with non-latin filenames.
I've spent few days googling the solutions, nothing helps.
How to fix it?
For some encoding problem, it's better to fix on the file's side rather than the environment, as the test should be machine-independent. If by any chance, we have to configure the environment. I would suggest putting the configuration code into your build script, so that it could be run successfully everywhere.
The filesystem encoding in Confluence has been set to ANSI_X3.4-1968. This encoding can cause issues in Confluence as the encoding supported in Confluence is only UTF-8 (If you are running an old Confluence's version, you might need to use the parameter below instead of the CATALINA_OPTS variable:)
This encoding can cause issues in Confluence as the encoding supported in Confluence is only UTF-8 (If you are running an old Confluence's version, you might need to use the parameter below instead of the CATALINA_OPTS variable:) In Redhat 6.x (RPM-Based distributions), set the LANG and LC_ALL values in /etc/sysconfig/i18n as follows:
This sounds like you are running into bug # 13643.
The easiest way to resolve this issue is to set the environment variable PYTHONIOENCODING
to utf-8
.
If you are using a virtual environment, make sure you set it up explicitly in the virtual environment; as it may not read the global variables.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With