title: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 139: ordinal not in range(128)
body: <p>I am working on a code which gets realtime tweets from twitter based on search term and save it to Mysql database. But when I run the code while inserting into database it raises an error: </p>
  
  <pre><code>UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 139: ordinal not in range(128)
  </code></pre>
  
  <p>I cannot understand what the problem is here is the code to insert into database</p>
  
  <pre><code>tweet = json.loads(data);
      #print json.dumps(tweet, indent=4, sort_keys=True)
      #print tweet['text']
      tweetid = tweet['id_str']
      userid = tweet['user']['id_str']
      text = tweet['text'].encode('utf-8')
      cur.execute("""INSERT INTO twitterfeeeds(tweet_id, user_id,body,status) VALUES (%s,%s,%s,'0')"""%(tweetid,userid,text))
      db.commit()
  </code></pre>
  
  <p>Here body is text in tweet and status is whether it is processed or not.</p>