You have data in the database that is binary but not unicode. What do you
want to do with it? You cannot decode('utf8'). Perhaps they already in
latin1?
On Thursday, 11 October 2012 06:47:35 UTC-5, Manu Mora wrote:
>
> Hello.
> I have a problem with code and decode chars. This is my code:
>
> # coding: utf8
>
> result = cdb.executesql("SELECT * FROM laptops")
>
> for reg in result:
> text = ("NĂºmero de serie: "+reg[0]).decode("utf8").encode("latin1")
>
>
>
> And this is the error: *("N\xc3\xbamero de serie:
> "+reg[0]).decode("utf8").encode("latin1")\nUnicodeDecodeError: \'ascii\'
> codec can\'t decode byte 0xc3 in position 1: ordinal not in range(128)\n'
> *
> *
> *
> Database sqlite is UTF8.
>
> Thanks.
>
--