def render_init(self, node): self.clear() encoding = node.raw.encoder.encoding self['file'] = decode(node[u'file'], encoding) self['width'] = decode(node[u'width'], encoding) self['height'] = decode(node[u'height'], encoding) self['param'] = [] node.render() node.remove()
def render_param(self, node): encoding = node.raw.encoder.encoding self['param'].append(( decode(node[u'name'], encoding), decode(node[u'value'], encoding), ))
#!/usr/bin/env python import warnings as _warnings _warnings.resetwarnings() _warnings.filterwarnings('error') # BEGIN INCLUDE from tdi.tools import html result = html.decode('André Malo, \x80', 'cp1252') print result.encode('unicode_escape') print result.encode('utf-8')