summaryrefslogtreecommitdiff
path: root/sphinx/directives/code.py
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-05-22 12:07:05 +0200
committerGeorg Brandl <georg@python.org>2010-05-22 12:07:05 +0200
commitbca665dca512d21380e8e6a0d740b1095afb5e4e (patch)
treeea00e124ba938cff2e94604a7afd029f2334b654 /sphinx/directives/code.py
parentf7083ee2abe8ce250310fb16527a67e967857c82 (diff)
downloadsphinx-bca665dca512d21380e8e6a0d740b1095afb5e4e.tar.gz
Fix for 12fea70b1a18: EncodedFile doesnt do the right thing either.
Diffstat (limited to 'sphinx/directives/code.py')
-rw-r--r--sphinx/directives/code.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py
index 65bd0122..b4375a98 100644
--- a/sphinx/directives/code.py
+++ b/sphinx/directives/code.py
@@ -115,8 +115,10 @@ class LiteralInclude(Directive):
line=self.lineno)]
encoding = self.options.get('encoding', env.config.source_encoding)
+ codec_info = codecs.lookup(encoding)
try:
- f = codecs.EncodedFile(open(fn, 'U'), encoding)
+ f = codecs.StreamReaderWriter(open(fn, 'U'),
+ codec_info.streamreader, codec_info.streamwriter, 'strict')
lines = f.readlines()
f.close()
except (IOError, OSError):