On the development platform upload works just fine, but when I deploy and test on the server upload fails with the following error
UnicodeEncodeError at /upload
'ascii' codec can't encode characters in position 25-30: ordinal not in range(128)
I use
django-ajax-uploader,
Django version: 1.3.1,
Python version: 2.6
I believe it happens about files with Roman, Russian, Chinese filenames.
Also found similar discussion at
Why do I get a ASCII encoding error with Unicode data in Python 2.4 but not in 2.7?
but about differences about Python versions.
I tried to set environment $LANG variable to en_US.utf8 etc. but it didn’t work.
Can anyone give me an advice or point a right way?
Thanks,
Sultan
See If you get a UnicodeEncodeError in the django docs.
Personally, I prefer to rename uploaded files to ASCII charset to avoid other problems as well. Here is a link to an article with code that describes subclassing FileSystemStorage .