I am with you and I think would be useful, TAG would be so useful with
XML. Actually skimming the code I could not find where the quirk is.
Additionally I see that unicode TAG names are indeed supported some
way:

>>> name=u'là'
>>> value='plain'
>>> TAG[name](value).xml()
u'<l\xe0>plain</l\xe0>'

Even value can be unicode but only with ASCII chars:

>>> name=u'là'
>>> value=u'plain'
>>> TAG[name](value).xml()
u'<l\xe0>plain</l\xe0>'

Problems arise when both name and values are not ascii chars:

>>> name=u'là'
>>> value=u'parà'
>>> TAG[name](value).xml()
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  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
3: ordinal
not in range(128)


On 16 Gen, 23:30, Jonathan Lundell <[email protected]> wrote:
> On Jan 16, 2011, at 2:00 PM, carlo wrote:
>
>
>
> >> Leave the tag itself a plain string.
>
> > don't you think this is a hard constraint?
> > Personally I do.
>
> > TAG promised to be such a handy tool to generate XML from Excel data,
> > which is the purpose of my app, but unfortunately this will not be
> > true.
>
> I suspect that TAG (and pretty much all of the stuff in gluon.html) was 
> intended for html rather than xml. I wouldn't think it'd be too hard to 
> support unicode tags, maybe with an option argument.

Reply via email to