logilab-common #298777 HTMLWriter throws UnicodeDecodeError if Section->Table.children contains unicode string [open]
This from logilab.common.ureports import HTMLWriter, Section, Table section = Section(u'Main Section') table = Table(cols=1, children=[u'\u20ac'], rheaders=1) section.append(table) HTMLWriter().format(section) Is throwing UnicodeDecodeError: Traceback (most recent call last): File "INSTALL_PATH/logilab/common/ureports/html_writer.py", line 92, in visit_table self.writeln(u'<th>%s</th>' % cell) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128) logilab.common.ureports.BaseWriter.compute_content is doing some really strange magic with StringIO and children rendering. It does not matter if You pass unicode object as children. compute_content converts it to bytestrings and than HTMLWriter fails while trying to output it. Related pylint issue: https://bitbucket.org/logilab/pylint/issues/420/html-report-unicodeencodeerror | |
priority | normal |
---|---|
type | bug |
done in | <not specified> |
closed by | <not specified> |