Opened 14 years ago

Closed 14 years ago

#14275 closed (invalid)

Russian file name file in upload

Reported by: Squidy Owned by: nobody
Component: File uploads/storage Version: 1.2
Severity: Keywords: utf8 utf-8 russian
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I have some model

  ogrn      = StdImageField(upload_to=get_upload_to ,blank=True)
  
  file1     = models.FileField(upload_to=get_upload_to ,blank=True)
  file2     = models.FileField(upload_to=get_upload_to ,blank=True)
  file3     = models.FileField(upload_to=get_upload_to ,blank=True)
  file4     = models.FileField(upload_to=get_upload_to ,blank=True)
  file5     = models.FileField(upload_to=get_upload_to ,blank=True)
  file6     = models.FileField(upload_to=get_upload_to ,blank=True)

When I upload file with russian name i get some error

UnicodeEncodeError at /manager/write/basket/1/

'ascii' codec can't encode characters in position 55-58: ordinal not in range(128)

Request Method: 	POST
Request URL: 	http://rudjins.squidy.ru/manager/write/basket/1/
Django Version: 	1.2.1
Exception Type: 	UnicodeEncodeError
Exception Value: 	

'ascii' codec can't encode characters in position 55-58: ordinal not in range(128)

Exception Location: 	/usr/local/lib/python2.6/genericpath.py in exists, line 18
Python Executable: 	/usr/local/bin/python
Python Version: 	2.6.5
Python Path: 	['/usr/local/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg', '/usr/local/lib/python2.6/site-packages/pytz-2010b-py2.6.egg', '/usr/local/lib/python2.6/site-packages/Pygments-1.2.2-py2.6.egg', '/usr/local/lib/python2.6/site-packages/Genshi-0.5.1-py2.6-freebsd-7.0-RELEASE-p10-amd64.egg', '/usr/local/lib/python2.6/site-packages/MySQL_python-1.2.3c1-py2.6-freebsd-7.0-RELEASE-p10-amd64.egg', '/usr/local/lib/python2.6/site-packages/Jinja2-2.1.1-py2.6-freebsd-7.0-RELEASE-p10-amd64.egg', '/usr/local/lib/python2.6/site-packages/Sphinx-0.6.4-py2.6.egg', '/usr/local/lib/python2.6/site-packages/flup-1.0.2-py2.6.egg', '/usr/local/lib/python2.6/site-packages/hg_git-0.2.2-py2.6.egg', '/usr/local/lib/python26.zip', '/usr/local/lib/python2.6', '/usr/local/lib/python2.6/plat-freebsd7', '/usr/local/lib/python2.6/lib-tk', '/usr/local/lib/python2.6/lib-old', '/usr/local/lib/python2.6/lib-dynload', '/usr/local/lib/python2.6/site-packages', '/usr/local/lib/python2.6/site-packages/PIL', '/usr/local/lib/python2.6/site-packages/django', '/pub/www/homepage/rudjins.squidy.ru/www/application']
Server time: 	Пнд, 13 Сен 2010 01:10:05 +0400

Change History (3)

comment:1 by Karen Tracey, 14 years ago

Resolution: invalid
Status: newclosed

The full traceback would help to diagnose, but this sounds like the server locale is not set correctly, see: http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#if-you-get-a-unicodeencodeerror (the problem is common to any server environment, not just Apache/mod_python, even though that is where this bit of doc happens to be).

comment:2 by Squidy, 14 years ago

Component: UncategorizedFile uploads/storage
Resolution: invalid
Status: closedreopened

comment:3 by Karen Tracey, 14 years ago

Resolution: invalid
Status: reopenedclosed

You've reopened without providing any additional details on why you think this is a bug in Django instead of an error in your server configuration. Without such additional information, there is nothing we can do to even help diagnose what is going on. The common reason for this type of error is server mis-configuration. Please verify your server's locale is set to allow Python to pass unicode to file system functions. For help on accomplishing that, please ask on django-users or #django IRC channel. Django does certainly allow uploading files with non-ASCII file names, so I strongly suspect it is your server configuration that needs fixing here, and that is something best achieved via help from other channels, not Django's trac.

Note: See TracTickets for help on using tickets.
Back to Top