#414: fix universal newline handling of files included with "literalinclude".

codecs.open() does not support U in the mode argument; use the EncodedFile wrapper instead.
This commit is contained in:
Georg Brandl 2010-05-22 10:49:42 +02:00
parent 2477249d42
commit cbf309fa65
2 changed files with 4 additions and 1 deletions

View File

@ -1,6 +1,9 @@
Release 0.6.6 (in development)
==============================
* #414: Fix handling of Windows newlines in files included with
the ``literalinclude`` directive.
* #377: Fix crash in linkcheck builder.
* #387: Fix the display of search results in ``dirhtml`` output.

View File

@ -116,7 +116,7 @@ class LiteralInclude(Directive):
encoding = self.options.get('encoding', env.config.source_encoding)
try:
f = codecs.open(fn, 'rU', encoding)
f = codecs.EncodedFile(open(fn, 'U'), encoding)
lines = f.readlines()
f.close()
except (IOError, OSError):