Lior Pozin
Lior Pozin

Reputation: 403

python unicode to str exception

I am trying to convert this unicode: u"\u2605 adasdadad" to str and got this exception:

UnicodeEncodeError: 'ascii' codec can't encode character u'\u2605' in position 0: ordinal not in range(128)

Help please.

Upvotes: 0

Views: 396

Answers (1)

Joran Beasley
Joran Beasley

Reputation: 114038

u"\u2605 adasdadad".encode("utf8")

perhaps

Upvotes: 3

Related Questions