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)
Change History (4)
by , 14 years ago
Attachment: | non_ascii_chars_fix.diff added |
---|
comment:1 by , 14 years ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
comment:2 by , 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 , 14 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
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
Fix, but probably not the right way