diff options
| author | Takayuki Shimizukawa <shimizukawa+bitbucket@gmail.com> | 2012-12-10 18:38:06 +0900 |
|---|---|---|
| committer | Takayuki Shimizukawa <shimizukawa+bitbucket@gmail.com> | 2012-12-10 18:38:06 +0900 |
| commit | b2f50bb3a5223c8007657e1528ac3b407bf09ab0 (patch) | |
| tree | 9901e2da8e2aef1d99fdcedeeda497d8748c8757 /sphinx/builders | |
| parent | 140b786e22bdcbdc97f6ef57d18dc4c10caeeaa7 (diff) | |
| parent | d45dcfbd7e5add4495a7e31ee53e672ee180d534 (diff) | |
| download | sphinx-b2f50bb3a5223c8007657e1528ac3b407bf09ab0.tar.gz | |
Merged in shimizukawa/sphinx-multibyte-filename-fork (pull request #61)
Diffstat (limited to 'sphinx/builders')
| -rw-r--r-- | sphinx/builders/epub.py | 9 |
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() |
