python - Struggling to handle emoji in tweepy script due to encoding issues -


this killing me , i'm struggling it... have utf-8 related issue python.

essentially trying pull stuff csv files tweet. involves picking column of emoji so:

t4 = function(random_line_from_csv_column_with_emoji)  tweet = t1.decode('utf-8') + " " + t2.decode('utf-8') + " " + t3.decode('utf-8') + " " + t4.decode('utf-8')  return tweet 

then file uses tweepy streaming api pull tweet module code above, , status update e.g.

chatresponse = get_the_tweet_above(options) replytext = '@' + screenname + ' ' + chatresponse twitterapi.update_status(status=replytext) 

most of time, code works... fails due encoding issues, e.g.:

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

those emoji, smiling cat face , clinking glasses or tumbler or something...

basically, tearing hair out try , work out how stop happening. always run encoding issues in python , have never got head around it.

if can make work quick , easy answer i'd happy!


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -