#185 non-ASCII names in odf config file

closed-fixed
nobody
None
5
2012-03-30
2012-03-11
Jakub Wilk
No

(I'm forwarding <https://bugs.launchpad.net/ubuntu/+source/python-docutils/+bug/938739>.)

If ODF configuration file contains names with non-ASCII characters, rst2odt dies with a traceback:

$ echo "[Formats]" > config
$ echo "textbody: żółw" >> config
$ echo test > test
$ rst2odt --traceback --odf-config-file=config test test.odt
Traceback (most recent call last):
File "/usr/bin/rst2odt", line 29, in <module>
description=description)
File "/usr/lib/pymodules/python2.7/docutils/core.py", line 538, in publish_cmdline_to_binary
config_section=config_section, enable_exit_status=enable_exit_status)
File "/usr/lib/pymodules/python2.7/docutils/core.py", line 213, in publish
output = self.writer.write(self.document, self.destination)
File "/usr/lib/pymodules/python2.7/docutils/writers/__init__.py", line 77, in write
self.translate()
File "/usr/lib/pymodules/python2.7/docutils/writers/odf_odt/__init__.py", line 549, in translate
self.assemble_my_parts()
File "/usr/lib/pymodules/python2.7/docutils/writers/odf_odt/__init__.py", line 560, in assemble_my_parts
content = self.visitor.content_astext()
File "/usr/lib/pymodules/python2.7/docutils/writers/odf_odt/__init__.py", line 1332, in content_astext
return self.astext()
File "/usr/lib/pymodules/python2.7/docutils/writers/odf_odt/__init__.py", line 1328, in astext
s1 = ToString(et)
File "/usr/lib/pymodules/python2.7/docutils/writers/odf_odt/__init__.py", line 310, in ToString
et.write(outstream)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 821, in write
serialize(write, self._root, encoding, qnames, namespaces)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 940, in _serialize_xml
_serialize_xml(write, e, encoding, qnames, None)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 940, in _serialize_xml
_serialize_xml(write, e, encoding, qnames, None)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 940, in _serialize_xml
_serialize_xml(write, e, encoding, qnames, None)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 933, in _serialize_xml
v = _escape_attrib(v, encoding)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1091, in _escape_attrib
return text.encode(encoding, "xmlcharrefreplace")
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc5 in position 0: ordinal not in range(128)

This only happens with Python 2.X, not with Python 3.X.

Discussion

  • Dave Kuhlman
    Dave Kuhlman
    2012-03-20

    Fixed. SVN revision 7385.

     
  • Günter Milde
    Günter Milde
    2012-03-30

    • status: open --> closed-fixed