How to decode a string

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Mon Aug 21 13:10:17 EDT 2006


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



More information about the Python-list mailing list