summaryrefslogtreecommitdiff
path: root/sphinx/builders
diff options
context:
space:
mode:
authorTakayuki Shimizukawa <shimizukawa+bitbucket@gmail.com>2012-12-10 18:38:06 +0900
committerTakayuki Shimizukawa <shimizukawa+bitbucket@gmail.com>2012-12-10 18:38:06 +0900
commitb2f50bb3a5223c8007657e1528ac3b407bf09ab0 (patch)
tree9901e2da8e2aef1d99fdcedeeda497d8748c8757 /sphinx/builders
parent140b786e22bdcbdc97f6ef57d18dc4c10caeeaa7 (diff)
parentd45dcfbd7e5add4495a7e31ee53e672ee180d534 (diff)
downloadsphinx-b2f50bb3a5223c8007657e1528ac3b407bf09ab0.tar.gz
Merged in shimizukawa/sphinx-multibyte-filename-fork (pull request #61)
Diffstat (limited to 'sphinx/builders')
-rw-r--r--sphinx/builders/epub.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/sphinx/builders/epub.py b/sphinx/builders/epub.py
index b4c3b277..c30fe735 100644
--- a/sphinx/builders/epub.py
+++ b/sphinx/builders/epub.py
@@ -662,7 +662,12 @@ class EpubBuilder(StandaloneHTMLBuilder):
zipfile.ZIP_STORED)
for file in projectfiles:
fp = path.join(outdir, file)
- if isinstance(fp, unicode):
- fp = fp.encode(sys.getfilesystemencoding())
+ if sys.version_info < (2, 6):
+ # When zipile.ZipFile.write call with unicode filename, ZipFile
+ # encode filename to 'utf-8' (only after Python-2.6).
+ if isinstance(file, unicode):
+ # OEBPS Container Format (OCF) 2.0.1 specification require
+ # "File Names MUST be UTF-8 encoded".
+ file = file.encode('utf-8')
epub.write(fp, file, zipfile.ZIP_DEFLATED)
epub.close()