Just running that in Python I get an error.

>>("Número de serie: "+"100").decode("utf8").encode("latin1")

UnicodeDecodeError: 'utf8' codec can't decode byte 0xfa in position 1: 
invalid start byte


I noticed that first line:
#coding: utf8

ú - this is a latin1 character, so you have an invalid python program, my 
man. Change that line to this:

#coding latin1

On Thursday, October 11, 2012 4:47:35 AM UTC-7, 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.
>

-- 



Reply via email to