summaryrefslogtreecommitdiff
path: root/sphinx/builders
diff options
context:
space:
mode:
authorshimizukawa <devnull@localhost>2012-05-01 15:13:06 +0900
committershimizukawa <devnull@localhost>2012-05-01 15:13:06 +0900
commit207e12471f451fee53a95ca6918c93abfef3a632 (patch)
tree555db29968bd2f149c3d04ddd90aba0fc7705fdb /sphinx/builders
parent7169e6598dd5663e538485accd9155b75e6681f4 (diff)
downloadsphinx-207e12471f451fee53a95ca6918c93abfef3a632.tar.gz
support multibyte filename handling.
https://bitbucket.org/birkenfeld/sphinx/issue/703
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()