[Tutor] Assistance with UnicodeDecodeError

Cristian Di Stefano cristian.distefano at isprambiente.it
Mon Feb 2 08:52:23 CET 2015


Hi Dave,

you should set the correct encoding (maybe utf-8) in order to handle 
data from web. You cannot handle unicode data with simple string, you 
should encode to ASCII or manage data with the unicode type

Best
Cristian

Il 31/01/2015 23:44, Dave Angel ha scritto:
> On 01/31/2015 08:37 AM, J Mberia wrote:
>> Hi,
>>
>
> Welcome to Python tutor.  Thanks for posting using text email, and for 
> specifying both your Python version and Operating system.
>
>> I am teaching myself programming in python and assistance with
>> UnicodeDecodeError
>>
>> I am trying to scrap text from a website using Python 2.7 in windows 
>> 8 and
>> i am getting this error *"**UnicodeDecodeError: 'charmap codec can't 
>> encode
>> character u'\u2014 in position 11231 character maps to <undefined>"*
>>
>> *How do i resolve? Pls assist.*
>>
>
> You can start by posting the whole error message, including the stack 
> trace.  Then you probably should include an appropriate segment of 
> your code.
>
> The message means that you've got some invalid characters that you're 
> trying to convert.  That can either be that the data is invalid, or 
> that you're specifying the wrong encoding, directly or implicitly.
>


---
Questa e-mail è stata controllata per individuare virus con Avast antivirus.
http://www.avast.com



More information about the Tutor mailing list