diff options
| author | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2004-07-24 18:35:09 +0000 |
|---|---|---|
| committer | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2004-07-24 18:35:09 +0000 |
| commit | 253d5324a1754ddda972807b0e2ff6303c3dbef4 (patch) | |
| tree | 224d4ac759a50ab5f1bb49eb4e760d6bfcd222e7 | |
| parent | 2bc818421e920944dce0b893e824c2ddb0430fea (diff) | |
| download | docutils-253d5324a1754ddda972807b0e2ff6303c3dbef4.tar.gz | |
xmlcharrefreplace backport
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@2448 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
| -rw-r--r-- | FAQ.txt | 6 | ||||
| -rw-r--r-- | docs/dev/todo.txt | 3 | ||||
| -rw-r--r-- | docs/ref/rst/restructuredtext.txt | 3 | ||||
| -rw-r--r-- | docs/user/config.txt | 4 | ||||
| -rw-r--r-- | docutils/core.py | 20 |
5 files changed, 17 insertions, 19 deletions
@@ -748,9 +748,9 @@ You may have an decoding problem in your browser (or editor, etc.). The encoding of the output is set to "utf-8", but your browswer isn't recognizing that. You can either try to fix your browser (enable "UTF-8 character set", sometimes called "Unicode"), or choose a -different encoding for the HTML output. If you're using Python 2.3+, -try ``--output-encoding=ascii:xmlcharrefreplace`` for HTML (not -applicable to non-XMLish outputs). +different encoding for the HTML output. You can also try +``--output-encoding=ascii:xmlcharrefreplace`` for HTML (not applicable +to non-XMLish outputs). If you're generating document fragments, the "Content-Type" metadata (between the HTML ``<head>`` and ``</head>`` tags) must agree with the diff --git a/docs/dev/todo.txt b/docs/dev/todo.txt index 47f8e4eff..f78abe63f 100644 --- a/docs/dev/todo.txt +++ b/docs/dev/todo.txt @@ -74,8 +74,7 @@ General * Need a Unicode to HTML entities codec for HTML writer? No, the "xmlcharrefreplace" output error handler is sufficient. - Make it the default for HTML & XML writers? Not as long as we need - to support Python versions prior to 2.3. + Make it the default for HTML & XML writers? * Add validation? See http://pytrex.sourceforge.net, RELAX NG, pyRXP. diff --git a/docs/ref/rst/restructuredtext.txt b/docs/ref/rst/restructuredtext.txt index 7f72a1b7f..a9d2b4afa 100644 --- a/docs/ref/rst/restructuredtext.txt +++ b/docs/ref/rst/restructuredtext.txt @@ -1587,8 +1587,7 @@ reused, doubled and then tripled, and so on ("**" etc.). in certain common text encodings such as Latin-1 (ISO 8859-1). The use of UTF-8 for the output encoding is recommended. An alternative for HTML and XML output is to use the - "xmlcharrefreplace" `output encoding error handler`__ (available in - Python 2.3 & later). + "xmlcharrefreplace" `output encoding error handler`__. __ ../../user/config.html#output-encoding-error-handler diff --git a/docs/user/config.txt b/docs/user/config.txt index 4a5c0a8fc..447c3a7bd 100644 --- a/docs/user/config.txt +++ b/docs/user/config.txt @@ -277,8 +277,8 @@ _`output_encoding_error_handler` ignore Ignore malformed data and continue without further notice. xmlcharrefreplace - (Python 2.3+) Replace with the appropriate XML character - reference, such as "``†``". + Replace with the appropriate XML character reference, such as + "``†``". backslashreplace (Python 2.3+) Replace with backslashed escape sequences, such as "``\u2020``". diff --git a/docutils/core.py b/docutils/core.py index 846041f32..17b8ddd7f 100644 --- a/docutils/core.py +++ b/docutils/core.py @@ -245,23 +245,23 @@ command line used.""" % (__version__, sys.version.split()[0])) def report_UnicodeError(self, error): print >>sys.stderr, '%s: %s' % (error.__class__.__name__, error) - print >>sys.stderr, (""" + print >>sys.stderr, """ The specified output encoding (%s) cannot handle all of the output. Try setting "--output-encoding-error-handler" to -""" % (self.settings.output_encoding)), + +* "xmlcharrefreplace" (for HTML & XML output);""" if sys.hexversion >= 0x02030000: # Python 2.3 - print >>sys.stderr, (""" -* "xmlcharrefreplace" (for HTML & XML output, Python 2.3+); + print >>sys.stderr, """\ the output will contain "%s" and should be usable. * "backslashreplace" (for other output formats, Python 2.3+); - look for "%s" in the output. -*""" % (error.object[error.start:error.end].encode('ascii', - 'xmlcharrefreplace'), - error.object[error.start:error.end].encode('ascii', - 'backslashreplace'))), + look for "%s" in the output.""" % ( + error.object[error.start:error.end].encode('ascii', 'xmlcharrefreplace'), + error.object[error.start:error.end].encode('ascii', 'backslashreplace')) + else: + print >>sys.stderr, ' the output should be usable as-is.' print >>sys.stderr, ("""\ -"replace" (Python 2.1 or 2.2); look for "?" in the output. +* "replace"; look for "?" in the output. "--output-encoding-error-handler" is currently set to "%s". |
