[Python] Che barba sta codifica!

Carlo Miron miron a python.it
Ven 19 Giu 2015 18:23:01 CEST


2015-06-19 17:56 GMT+02:00 Manlio Perillo <manlio.perillo a gmail.com>:

> 2015-06-19 16:58 GMT+02:00 Diego Barrera <diegonebarrera a yahoo.it>:
>> e sto usando Python 2.17.9, leggendo la stringa

Python 2.17.9 ??? :P

>> via 1° Maggio, 21
>> ottengo il seguente errore:
>>
>>     raise DjangoUnicodeDecodeError(s, *e.args)
>> DjangoUnicodeDecodeError: 'utf8' codec can't decode byte 0xf8 in position
>> 5: invalid start byte. You passed in 'via 1\xf8 Maggio, 21' (<type 'str'>)

Su un Python molto pił vecchio, 2.7.9:

    >>> print 'via 1\xf8 Maggio, 21'.decode('cp850')
    via 1° Maggio, 21

Ciao,
©

-- 
|:**THE BEER-WARE LICENSE** (Revision 42):
| <miron a python.it> wrote this mail. As long as you retain
| this notice you can do whatever you want with this stuff.
| If we meet some day, and you think this stuff is worth it,
| you can buy me a beer in return.
|                                            --Carlo Miron :


Maggiori informazioni sulla lista Python