How to decode a string

Lad python at hope.cz
Tue Aug 22 02:47:19 EDT 2006


Marc 'BlackJack' Rintsch wrote:
> In <1156175385.580508.302330 at m73g2000cwd.googlegroups.com>, Lad wrote:
>
> > The text is from Mysql table field that uses utf8_czech_ci collation,
> > but when I try
> > `RealName`.decode('utf8'),where RealName is that  field of MySQL
> >
> > I will get:
> > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3:
> > ordinal
> > not in range(128)
> >
> > Can you please suggest the solution?
>
> Do you get this from converting the value from the database or from trying
> to print the unicode string?  Can you give us the output of
>
>   print repr(RealName)
>
> Ciao,
	Marc 'BlackJack' Rintsch

for
print repr(RealName)  command
I will get

P?ibylov\xe1 Ludmila
where instead of  ? should be also a character
Thank you for help
L.




More information about the Python-list mailing list