diff options
| author | Georg Brandl <georg@python.org> | 2010-05-22 12:07:05 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2010-05-22 12:07:05 +0200 |
| commit | bca665dca512d21380e8e6a0d740b1095afb5e4e (patch) | |
| tree | ea00e124ba938cff2e94604a7afd029f2334b654 /sphinx/directives/code.py | |
| parent | f7083ee2abe8ce250310fb16527a67e967857c82 (diff) | |
| download | sphinx-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.py | 4 |
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): |
