[Tutor] Encoding

Patrick Sabin patrick.just4fun at gmail.com
Wed Mar 3 12:24:41 CET 2010

Giorgio wrote:
> i am looking for more informations about encoding in python:
> i've read that Amazon SimpleDB accepts every string encoded in UTF-8. 
> How can I encode a string? And, what's the default string encoding in 
> python?

I think the safest way is to use unicode strings in your application and 
convert them to byte strings if needed, using the encode and decode methods.

> the other question is about mysql DB: if i have a mysql field latin1 and 
> extract his content in a python script, how can I handle it?

if you have a byte string s encoded in 'latin1' you can simply call:

to get the unicode string.

> thankyou
> Giorgio


More information about the Tutor mailing list