Commits

Jun Omae  committed 39fae97

Encodes filename in zip archive with cp932 for Windows Japanese Edition (sf.jp #28096)

  • Participants
  • Parent commits 625bd30

Comments (0)

Files changed (1)

File python-lib/trac/trac/versioncontrol/web_ui/changeset.py

             if kind == Node.FILE and change != Changeset.DELETE \
                     and new_node.can_view(req.perm):
                 zipinfo = ZipInfo()
-                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.
+                # Note: cp932 is ANSI codepage for Windows Japanese Edition
+                zipinfo.filename = new_node.path.strip('/').encode('cp932')
                 zipinfo.date_time = \
                     new_node.last_modified.astimezone(req.tz).timetuple()[:6]
                 zipinfo.external_attr = 0644 << 16L # needed since Python 2.5