summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2009-08-06 23:03:49 +0200
committerGeorg Brandl <georg@python.org>2009-08-06 23:03:49 +0200
commit7ec795d178ccbb7138e2b87287f0054c53d3d5fd (patch)
tree867b5cfb70b6ea4e186456d56ef77e876d7cd5ae /sphinx/directives/code.py
parentf17584c428c9afb4bce239b4d62ff606ac2f5736 (diff)
parente370fa76a761176ff37d608754a22b40ceaaedad (diff)
downloadsphinx-7ec795d178ccbb7138e2b87287f0054c53d3d5fd.tar.gz
merge with 0.6
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r--sphinx/directives/code.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
index 2c70ada8..4f44c333 100644
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -103,7 +103,13 @@ class LiteralInclude(Directive):
else:
docdir = path.dirname(env.doc2path(env.docname, base=None))
rel_fn = path.normpath(path.join(docdir, filename))
- fn = path.join(env.srcdir, rel_fn)
+ try:
+ fn = path.join(env.srcdir, rel_fn)
+ except UnicodeDecodeError:
+ # the source directory is a bytestring with non-ASCII characters;
+ # let's try to encode the rel_fn in the file system encoding
+ rel_fn = rel_fn.encode(sys.getfilesystemencoding())
+ fn = path.join(env.srcdir, rel_fn)
if 'pyobject' in self.options and 'lines' in self.options:
return [document.reporter.warning(