Sublime Forum

Encoding utf-8 error

#1

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

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.

0 Likes

#2

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?

0 Likes

#3

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.

0 Likes