Python3 - temporarily change the file encoding
jarausch at igpm.rwth-aachen.de
Fri Mar 21 18:48:49 CET 2014
my locale is en_US.iso88591
But now I'd like to process a restructuredtext file which is encoded in utf-8.
# $Id: rst2html.py 4564 2006-05-21 20:44:42Z wiemann $
# Author: David Goodger <goodger at python.org>
# Copyright: This module has been placed in the public domain.
A minimal front end to the Docutils Publisher, producing HTML.
from docutils.core import publish_cmdline, default_description
description = ('Generates (X)HTML documents from standalone reStructuredText '
'sources. ' + default_description)
Even if I comment out the part containing 'import locale' the utf-8 encoding of my
rst-file is not recognized.
How can I change this so that rst2html use utf-8 when reading and writing files.
Of course, I don't want to change the docutils package for that.
Many thanks for a hint,
More information about the Python-list