In fact looks like it loses the UTF-8 enconding when I print it or convert
it to string...

Is there a way to re encode it?

Regards,

tito

On Sun, Apr 11, 2010 at 11:35 AM, mdipierro <[email protected]> wrote:

> Are you tell me that
>
> items=db(db.mytable.id>0).select(limitby=(0,1))
> print items[0].as_dict()
> for item in items: print item.as_dict()
>
> produce two different outputs? It cannot be.
>
> Massimo
>
>
> On Apr 11, 9:00 am, Tito Garrido <[email protected]> wrote:
> > I can get it as UTF-8 if I execute:
> > test=db(db.mytable.id>0).select()[0].as_dict()
> >
> > return test
> >
> > Not sure why it's not encoding on the former situation.
> >
> > How could I convert it manually?
> >
> > Thanks!
> >
> >
> >
> > On Sun, Apr 11, 2010 at 2:15 AM, mdipierro <[email protected]>
> wrote:
> > > I am not sure the issue is web2py here. It may be 1) the encoding in
> > > the db should be utf8 and it is not, 2) the data has been stored
> > > incorrecly. web2py does not convert data to UTF8 when extracting from
> > > DB but when inserting only.
> >
> > > On Apr 10, 11:17 pm, Tito Garrido <[email protected]> wrote:
> > > > Hi Folks,
> >
> > > > I'm not sure why but when I'm using as_dict function in a row element
> > > it's
> > > > not returning UTF-8 characters an example:
> >
> > > > db.define_table('evento',
> > > >     SQLField('dono','reference
> auth_user',writable=False,readable=False),
> > > >     SQLField('paciente', 'reference paciente', label='Paciente*'),
> > > >     SQLField('titulo', 'string', length=255
> > > ,default='',label='Assunto*'),
> > > >     SQLField('data','date',default=request.now,readable=False),
> > > >     SQLField('horario','time',readable=False),
> > > >     SQLField('duracao','integer'),
> > > >     SQLField('status', 'string', length=255 ,default='Marcado'),
> > > >     SQLField('comentario', 'text',default=''),
> > > >     SQLField('criado_por','reference
> > > > auth_user',writable=False,readable=False))
> >
> > > > eventos=db((db.evento.data.day()==data.day)&
> > > >         (db.evento.data.month()==data.month)&
> > > >         (db.evento.data.year()==data.year)&
> > > >         (db.evento.dono==dono_id)).select(orderby=db.evento.horario)
> >
> > > >      for evento in eventos:
> > > >         *eventos_as_list.append(evento.as_dict())*
> > > >         #some other operations
> >
> > > > return eventos_as_list
> >
> > > > Those elements inside this list "eventos_as_list" are not encoded as
> > > utf-8,
> > > > it shows something like:
> > > > *{'status': 'Marcado', 'paciente': 1, 'id': 11, 'horario':
> '08:00:00',
> > > > 'criado_por': 2, 'dono': 2, 'titulo': 'Criado pelo modal', 'data':
> > > > '2010-03-20', 'comentario': 'Descri\xc3\xa7ao \xc3\xa1
> > > \xc3\xa9\r\n\r\ncom
> > > > mais uma linha\r\n\r\natt'}*
> >
> > > > Not sure if it's happening because I'm appending it to a list... is
> there
> > > a
> > > > way to solve it?
> >
> > > > Regards,
> >
> > > > Tito
> >
> > > > --
> >
> > > > Linux User #387870
> > > > .........____
> > > > .... _/_õ|__|
> > > > ..º[ .-.___.-._| . . . .
> > > > .__( o)__( o).:_______
> >
> > > --
> > > To unsubscribe, reply using "remove me" as the subject.
> >
> > --
> >
> > Linux User #387870
> > .........____
> > .... _/_õ|__|
> > ..º[ .-.___.-._| . . . .
> > .__( o)__( o).:_______
>



-- 

Linux User #387870
.........____
.... _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:_______

Reply via email to