[Tutor] dictionary2unicode and unicode2dictionnary
Kristian Zoerhoff
kristian.zoerhoff at gmail.com
Fri Apr 8 14:47:31 CEST 2005
On Apr 8, 2005 6:29 AM, BRINER Cedric <work at infomaniak.ch> wrote:
>
> <(hint: rsmFirstname = françois)>
>
> import pickle
>
> q=pickle.dumps(a)
> >>> type(q)
> <type 'str'>
> so this is a string
>
> >>> unicode(q)
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 64:
> ordinal not in range(128)
Call unicode() with an encoding that can handle the character in question:
>>>unicode(q, 'latin-1')
and it should work just fine (I just tested this in pythonwin).
--
Kristian
kristian.zoerhoff(AT)gmail.com
zoerhoff(AT)freeshell.org
More information about the Tutor
mailing list