Home Download Buy Blog Forum Support

Encoding utf-8 error

Encoding utf-8 error

Postby ytq on Thu Apr 04, 2013 10:34 am

Hi,
I'm getting this error when playing around with an utf-8 encoded site:

Code: Select all
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe9' in position 9: ordinal not in range(128)


Weird enough, everything's fine when I'm running my code on another text editor. Suggestions?

I'm on Windows Vista.
ytq
 
Posts: 2
Joined: Thu Apr 04, 2013 10:28 am

Re: Encoding utf-8 error

Postby duncan on Sat Apr 06, 2013 9:13 am

What version of ST are you using?
ST2? ST3? What build number?

What form did your 'playing around' take?

The error message is telling you that you are trying to use the ASCII codec on a utf-8 encoded stream.
It's a common thing to see when moving code between Python 2 and Python 3 due to the different defaults in how unicode is handled.
Does whatever it is you were doing make sense of the error in that context?
duncan
 
Posts: 22
Joined: Sat Aug 27, 2011 12:59 pm

Re: Encoding utf-8 error

Postby ytq on Sat Apr 06, 2013 12:46 pm

I'm scraping an utf-8 encoded website, which indeed contains non-ascii characters.

I'm using ST 2, build number 2217

I'm also using Python 2.7 is this is of any relevance.
ytq
 
Posts: 2
Joined: Thu Apr 04, 2013 10:28 am


Return to Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 25 guests