Python os.stat and unicode file names

前端 未结 5 822
我寻月下人不归
我寻月下人不归 2020-12-31 05:05

In my Django application, a user has uploaded a file with a unicode character in the name.

When I\'m downloading files, I\'m calling :

os.path.exists         


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-31 05:26

    None of these solutions worked for me. However, I did find the (a?) solution. There is yet another place in Apache settings where one has to add the locale setting if one uses WSGI. Official docs are here. Add the following two lines to /etc/apache2/envvars (on Ubuntu):

    export LANG='en_US.UTF-8'
    export LC_ALL='en_US.UTF-8'
    

    Then restart the server. This solved my problem.

提交回复
热议问题