diff options
| author | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2006-09-16 21:32:29 +0000 |
|---|---|---|
| committer | wiemann <wiemann@929543f6-e4f2-0310-98a6-ba3bd3dd1d04> | 2006-09-16 21:32:29 +0000 |
| commit | 77c6b7954387d9b84ac7ea1e5ad7484d7c27483f (patch) | |
| tree | e83f5e28d4d00c99a51aa3d4040b8078a31421e7 /docutils/io.py | |
| parent | c6c7958597c3114ce3ff9bdc936e1a1ead97f2ed (diff) | |
| download | docutils-77c6b7954387d9b84ac7ea1e5ad7484d7c27483f.tar.gz | |
added support for IronPython 1.0 (thanks to Seo Sanghyeon);
closing http://sf.net/tracker/?func=detail&atid=422032&aid=1550267&group_id=38414
git-svn-id: http://svn.code.sf.net/p/docutils/code/trunk/docutils@4750 929543f6-e4f2-0310-98a6-ba3bd3dd1d04
Diffstat (limited to 'docutils/io.py')
| -rw-r--r-- | docutils/io.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/docutils/io.py b/docutils/io.py index 4abca97bc..dcce35324 100644 --- a/docutils/io.py +++ b/docutils/io.py @@ -197,13 +197,14 @@ class Output(TransformSpec): else: try: return data.encode(self.encoding, self.error_handler) - except ValueError: - # ValueError is raised if there are unencodable chars - # in data and the error_handler isn't found. + except (LookupError, ValueError): + # LookupError is raised if there are unencodable chars + # in data and the error_handler isn't found. In old + # Python versions, ValueError is raised. if self.error_handler == 'xmlcharrefreplace': # We are using xmlcharrefreplace with a Python - # version that doesn't support it (2.1 or 2.2), so - # we emulate its behavior. + # version that doesn't support it (2.1, 2.2, or + # IronPython 1.0) so we emulate its behavior. return ''.join([self.xmlcharref_encode(char) for char in data]) else: |
