title: Arabic, Unicode and files in python
body: <p>I am trying to grab some text written in Arabic from Youtube, writting it into a file and reading it again.</p>
  
  <p>The source file to grab the text has:</p>
  
  <pre><code>#!/usr/bin/python
  #encoding: utf-8
  </code></pre>
  
  <p>in the beginning of the file.</p>
  
  <p>Writing the text are done like this:</p>
  
  <pre><code>f.write(comment + '\n' )
  </code></pre>
  
  <p>The file contents is readable Arabic, so I assume the previous steps were correct.</p>
  
  <p>But the problem appears when trying to read the contents from the file (and writing them for example into another file) like this:</p>
  
  <pre><code>in = open('data_Pass1/EG', 'rb')
  out.write(in.read())
  </code></pre>
  
  <p>Which results in output file like this:</p>
  
  <pre><code>\xd8\xa7\xd9\x8a\xd9\x87
  </code></pre>
  
  <p>What is causing this?</p>