Edgewall Software

Opened 14 years ago

Closed 2 years ago

Last modified 2 years ago

#4432 closed defect (worksforme)

Filenames in Zip-Downloads corrupted

Reported by: anw@… Owned by:
Priority: normal Milestone:
Component: version control/browser Version: 0.10.2
Severity: minor Keywords: preferences, zip
Cc: Thijs Triemstra Branch:
Release Notes:
API Changes:
Internal Changes:

Description (last modified by Christian Boos)

Filenames in Zip-Downloads of whole directories are corrupted when they contain any special chars (like german umlaute). For example ü is replaced by ++.

Attachments (0)

Change History (13)

comment:1 by Christian Boos, 14 years ago

Well, the filename is currently saved as an UTF-8 string, which is not supported by all Zip tools. Last time I've checked, other choices were even worse/less portable.

What would you suggest?

comment:2 by anonymous, 14 years ago

What about a config option to set the encoding of filenames ?

comment:3 by Christian Boos, 14 years ago

Rather as an user preference then, as this corresponds to the client tool used, not to something that can be known from the server side.

comment:4 by anonymous, 14 years ago

Well, I think this could be a server config. Because in your project so sould define your filename conventions. and these conventions than match your server config. Or even as an default for the client-option, beacause many users would not know which filenameencoding to use.

comment:5 by Christian Boos, 14 years ago

Description: modified (diff)
Keywords: preferences added
Milestone: 0.11
Severity: normalminor
Summary: Filenames in Zip-Downloads corupptedFilenames in Zip-Downloads corrupted

It's not a matter of conventions, it's a matter of what filesystem you're using on your computer, and what Zip tools you're using. See r3096.

E.g. I think that on Macintosh, a popular Zip tool expects UTF-8 encoded filenames.

But yes, we could try to pick up some "sane" default if the user preference is not set, e.g. the same as the configured default charset for the repository.

comment:6 by Christian Boos, 13 years ago

Milestone: 0.110.12

Not for 0.11.

comment:7 by Thijs Triemstra, 9 years ago

Cc: Thijs Triemstra added

comment:8 by Thijs Triemstra, 9 years ago

Keywords: zip added

comment:9 by Thijs Triemstra, 9 years ago

trunk/trac/versioncontrol/web_ui/changeset.py has:

zipinfo.filename = new_node.path.strip('/').encode('utf-8')
# Note: unicode filenames are not supported by zipfile.
# UTF-8 is not supported by all Zip tools either,
# but as some do, I think UTF-8 is the best option here.

comment:10 by Ryan J Ollos, 6 years ago

Keywords: preferences zip → preferences, zip

comment:11 by Ryan J Ollos, 5 years ago

Owner: Christian Boos removed

comment:12 by anonymous, 2 years ago

The comment:9 refers to this code, but it was later moved to trac.versioncontrol.web_ui.util.render_zip, and from there moved again to trac.util.create_zipinfo.

Also the "Language Encoding flag" is now set there (since #10679) to indicate filenames are UTF-8 encoded, but comment:2:ticket:10679:

So I suppose this would fix #4432?

I think that it should keep open, because Zip folder in Windows cannot handle the bit.

I think that Windows users need "encoding for zip archive" option in trac.ini and user preference.

zip folder in Windows XP and 7 extracts broken filename

Testing with a ZIP (created with 7-Zip) containing filename €.ü, Windows 10 Zip folder seems to work now, but I have not tested ZIP files created by Trac.

in reply to:  12 comment:13 by Jun Omae, 2 years ago

Milestone: next-major-releases
Resolution: worksforme
Status: newclosed

Replying to anonymous:

Testing with a ZIP (created with 7-Zip) containing filename €.ü, Windows 10 Zip folder seems to work now, but I have not tested ZIP files created by Trac.

Thanks for the information. I just tested zip file generated by Trac on Windows 10. The zip folder works fine and unicode file name extracted from the zip file are correct.

Closing by #10679.

Version 0, edited 2 years ago by Jun Omae (next)

Modify Ticket

Change Properties
Set your email in Preferences
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment

E-mail address and name can be saved in the Preferences .
Note: See TracTickets for help on using tickets.