Ok this works :
tbl.append(
TR(
TC(
P(
R(
T(r.first_name.decode('utf-8')),
),
),
),
TC(
P(
R(
T(r.last_name.decode('utf-8')),
),
),
),
Richard
On Tue, Oct 18, 2011 at 2:52 PM, Richard Vézina <[email protected]
> wrote:
> Here the error message that I get when I try to insert the output of this
> piece of code into my xml :
>
> from lxml import etree
> from lxml.builder import ElementMaker
> from lxml.etree import Comment, ProcessingInstruction
> from StringIO import StringIO
> from copy import deepcopy
>
> W = ElementMaker(namespace=\
> "http://schemas.microsoft.com/office/word/2003/wordml"\
> ,nsmap={'w' : "
> http://schemas.microsoft.com/office/word/2003/wordml"})
>
> TR = W.tr
>
> query = db.auth_user.first_name=='Richard'
> rows=db(query).select(db.auth_user.ALL)
>
> for r in rows:
> tbl.append(
> TR(
> TC(
> P(
> R(
> T(r.last_name),
> ),
> ),
> )
> ))
>
>
> Error : All strings must be XML compatible: Unicode or ASCII, no NULL bytes
>
> Thanks
>
> Richard
>
>
>
> On Tue, Oct 18, 2011 at 2:46 PM, Richard <[email protected]>wrote:
>
>> Hello,
>>
>> Is web2py use unicode or ascii internally for string?
>>
>> I found having problem inserting value from a web2py select query into
>> custom xml building export that I build with lxml...
>>
>> How or where to specify that I want the row.field output to be utf-8?
>>
>> Thanks
>>
>> Richard
>
>
>