On Jan 16, 2011, at 1:22 AM, carlo wrote:
> 
>>>> r=TAG['pippo'](u'plutò')
>>>> str(r)
> '<pippo>plut\xc3\xb2</pippo>'
>>>> r=TAG[u'pippo'](u'plutò')
>>>> str(r)
> Traceback (most recent call last):
>  File "<console>", line 1, in <module>
>  File "C:\Python26\web2py\gluon\html.py", line 797, in __str__
>    return self.xml()
>  File "C:\Python26\web2py\gluon\html.py", line 790, in xml
>    return '<%s%s>%s</%s>' % (self.tag, fa, co, self.tag)
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position
> 4: ordinal
> not in range(128)

The content of TAG is explicitly decoded, but the tag itself is not. I'm 
guessing that making the tag a unicode string is forcing a second decode of 
your content. Or something like that.

Leave the tag itself a plain string.

Reply via email to