Commits

Georg Brandl  committed b2aca87

Fix for 12fea70b1a18: EncodedFile doesnt do the right thing either.

  • Participants
  • Parent commits 740edb0

Comments (0)

Files changed (1)

File sphinx/directives/code.py

                 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):