Commits

Anonymous committed 79ecde1

Fix file path handling in the epub builder

Comments (0)

Files changed (1)

sphinx/builders/epub.py

 
 import os
 import re
+import sys
 import time
 import codecs
 import zipfile
         epub.write(path.join(outdir, 'mimetype'), 'mimetype', \
             zipfile.ZIP_STORED)
         for file in projectfiles:
-            if isinstance(file, unicode):
-                file = file.encode('utf-8')
-            epub.write(path.join(outdir, file), file, zipfile.ZIP_DEFLATED)
+            fp = path.join(outdir, file)
+            if isinstance(fp, unicode):
+                fp = fp.encode(sys.getfilesystemencoding())
+            epub.write(fp, file, zipfile.ZIP_DEFLATED)
         epub.close()