title: how to convert the unicode to latin characters python
body: <p>I want to convert the unicode to its latin character using python, I have a big text file having the tweets containing the unicode and all. I just want to replace 4 unicode like \u00f6, \u015f ,..
  I just want how the tweet was actually tweeted.(original language).Here is the code which actually collects the tweets and saves into the text file.I have added&quot;#!/usr/bin/python</p>
  <h1><em>*</em> coding :ISO 8859-9_*_....&quot;I get this error &quot;Non-ASCII character '\xf6' in file turkey_code.py on line 21, but no encoding declared; see <a href="http://www.python.org/peps/pep-0263.html" rel="nofollow noreferrer">http://www.python.org/peps/pep-0263.html</a> for details&quot;</h1>
  <pre><code>class listener(StreamListener):
  
      def on_data(self,data):
          try:
              dirty = open('turkeyjson28.txt','a')
              encode = data.encode('ascii','ignore')
              dirty.write(encode)
              good = tweet.decode(&quot;utf-8&quot;) &quot;&quot;&quot;
              better = good.decode(&quot;utf=8&quot;).replace(u&quot;\u00f6&quot;, &quot;ö&quot;)
              print better    
              dirty.write('\n')
              dirty.close()
              tweet = data.split(',&quot;text&quot;:&quot;')[1].split('&quot;,&quot;source')[0]
              #saveThis = str(time.time())+'::'+tweet
              saveFile = open('turkey_clean28.txt','a')
              saveFile.write(better)
              saveFile.write('\n')
              saveFile.write('\n')
              saveFile.close()
              return True
          except BaseException, e:
              print 'failed ondata,',str(e)
              time.sleep(5)
      def on_error(self, status):
          print status
  
  auth = OAuthHandler(ckey,csecret)
  auth.set_access_token(atoken,asecret)
  twitterStream = Stream(auth,listener())
  twitterStream.filter(track = [&quot;turkey&quot;])
  </code></pre>