From 80f6ac599f79546512b522566cb421acea1aca19 Mon Sep 17 00:00:00 2001 From: Waylan Limberg Date: Thu, 28 Jul 2011 10:02:38 -0400 Subject: All internal encoding of output now uses the 'xmlcharrefreplace' error handler. Also added a note to the docs. Anyone doing their own encoding of output should be as well. --- docs/using_as_module.txt | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'docs/using_as_module.txt') diff --git a/docs/using_as_module.txt b/docs/using_as_module.txt index 343fee0..f50a0ec 100644 --- a/docs/using_as_module.txt +++ b/docs/using_as_module.txt @@ -39,7 +39,10 @@ The following options are available on the `markdown.markdown` function: If you want to write the output to disk, you must encode it yourself: - output_file = codecs.open("some_file.html", "w", encoding="utf-8") + output_file = codecs.open("some_file.html", "w", + encoding="utf-8", + errors="xmlcharrefreplace" + ) output_file.write(html) * `extensions`: A list of extensions. @@ -178,7 +181,8 @@ the following required options: * or `None` (default) which will write to `stdout`. * `encoding`: The encoding of the source text file. Defaults to - "utf-8". The same encoding will always be used for the output file. + "utf-8". The same encoding will always be used for the output file. + The 'xmlcharrefreplace' error handler is used when encoding the output. **Note:** This is the only place that decoding and encoding of unicode takes place in Python-Markdown. If this rather naive solution does not -- cgit v1.2.3