Code

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#12898 closed (fixed)

non-english filenames broken on Windows after r10693

Reported by: vrehak Owned by: nobody
Component: File uploads/storage Version: 1.1
Severity: Keywords:
Cc: ales.zoulek@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

The changeset r10693 fixing #11030 (File uploads break on non english
filesystem encoding) introduced a problem with non english filenames
in my setup (Windows XP or 2003, Python2.6, Apache). If I upload a
file with czech characters (e.g. čeština.txt - the first character is
ccaron or \u010d, the 3rd is scaron or \u0161) the file created on
Windows filesystem has a crippled name (Ä«eÅ·tina.txt).

The problem is caused by smart_str converting the unicode string into
bytestring. If I revert r10693 and let the filename be passed to
os.open() as unicode string, the file is correctly created on the
filesystem. I think that smart_str should be called only if the
underlying filesystem cannot handle unicode characters in the
filename.

Originally reported at http://groups.google.com/group/django-developers/browse_thread/thread/a8672274e4de5bad

Attachments (0)

Change History (5)

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by ales_zoulek

  • Cc ales.zoulek@… added

comment:3 Changed 4 years ago by kmtracey

  • Resolution set to fixed
  • Status changed from new to closed

(In [12662]) [1.1.X] Fixed #12898: Reverted a change that assumed the file system encoding was utf8, and changed a test to demonstrate how that assumption corrupted uploaded non-ASCII file names on systems that don't use utf8 as their file system encoding (Windows for one, specifically). Thanks for the report to vrehak.

r12661 from trunk.

comment:4 Changed 4 years ago by kmtracey

(In [12676]) Fixed the files test to not care whether the names are reported as bytestrings or unicode. Refs #12898.

comment:5 Changed 4 years ago by kmtracey

(In [12677]) [1.1.X] Fixed the files test to not care whether the names are reported as bytestrings or unicode. Refs #12898.

r12676 from trunk.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.