Python Unicode to String conversion

Richard Levasseur richardlev at gmail.com
Mon Sep 17 00:33:14 EDT 2007


> On 1 sep, 09:17, iapain <iap... at gmail.com> wrote:
>
> > First make sure your DB encoding is UTF-8 not the latin1
>

It took me days to figure out what was going on when dealing with
unicode, ascii, latin1, utf8, decodeerrors, etc, so I'm just chiming
in to echo something similar iapain's comments:

When dealing with unicode, i've run into situations where I have
multiple encodings in the same string, usually latin1 and utf8
(latin1 != ascii, and latin1 != utf8, and they don't play nice
together). So, for future readers, if you have problems dealing with
unicode encode and decode, try using a mix of latin1 and utf8
encodings to figure out whats going on, and what characters are
fubar'ing the process.




More information about the Python-list mailing list