Opened 14 years ago

Closed 14 years ago

#13550 closed (invalid)

Saving files with non ascii chars fails

Reported by: oyvind Owned by: nobody
Component: Uncategorized Version: dev
Severity: Keywords: ascii unicode storage
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

Uploading a file with ÆÅØ fails.

Attachments (1)

non_ascii_chars_fix.diff (1.8 KB ) - added by oyvind 14 years ago.
Fix, but probably not the right way

Download all attachments as: .zip

Change History (4)

by oyvind, 14 years ago

Attachment: non_ascii_chars_fix.diff added

Fix, but probably not the right way

comment:1 by oyvind, 14 years ago

Needs tests: set
Patch needs improvement: set

comment:2 by Alex Gaynor, 14 years ago

This doesn't look correct. There are tests for uploading files with unicode chars, and indeed the Python os APISs support taking unicode and automatically encode it to sys.getfilesystemencoding().

comment:3 by Karen Tracey, 14 years ago

Resolution: invalid
Status: newclosed

We do have a test of uploading files with non-ASCII data in their names. In fact that has caused a bit of a problem because not all buildbots have been set up properly to support this. See: http://code.djangoproject.com/wiki/ExpectedTestFailures

Converting to bytestrings within Django is not right because Django does not know the right encoding to use. Forcing utf-8 corrupts the file names on some systems (Windows) that do not use utf-8 encoding. The right answer is to correctly set the locale for the running server so that unicode strings can be successfully passed through to the os routines. See for example: http://docs.djangoproject.com/en/dev/howto/deployment/modpython/#if-you-get-a-unicodeencodeerror

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