I just run this and it works with sqlite. I did not yet have a chance
to try it with postgresql.
# -*- coding: utf-8 -
*-
db.define_table('test',Field('name'))
db.test.insert(name='testé')
print db(db.test.id>0).select()
and it works fine with me. I cannot reproduce your problem which
On Jun 8, 7:36 am, Felipe <[email protected]> wrote:
> xmlrpclib.Fault: <Fault 1: "<type
> 'exceptions.UnicodeDecodeError'>:'ascii' codec
> can't decode byte 0xc3 in position 4: ordinal not in range(128)">
>
> same problem ...
>
> On Jun 7, 3:17 pm, mdipierro <[email protected]> wrote:
>
> > hmmm, please try
>
> > bd[tab].insert(nome=u'testé')
>
> > or
>
> > bd[tab].insert(nome='testé'.encode('utf8'))
>
> > On Jun 7, 9:49 am, Felipe <[email protected]> wrote:
>
> > > Hi,
>
> > > I'm having problems with UTF8 words and databases...
>
> > > Now I'm using postgres with web2py. I used a xml-rpc script, just for
> > > testing, to insert into a table the word 'testé', apparently
> > > everything worked well, but when I try to get the info from the table
> > > I receive an error, 'cant decode unicode byte ... something', so i
> > > went to the postgres comand line and did
>
> > > select * from table;
>
> > > and i got a testÚ in the table...
>
> > > the database is using correct utf8, i know that web2py is also all
> > > utf8 and the xml-rpc also used utf8
>
> > > here it is come source code
>
> > > id = bd[tab].insert(nome='testé')
> > > try:
> > > bd.commit()
> > > retorno = 1
> > > except:
> > > retorno = 0
> > > return retorno