title: latin-1 vs unicode in python
body: <p>I was reading this <a href="https://stackoverflow.com/questions/2596714/why-does-python-print-unicode-characters-when-the-default-encoding-is-ascii?rq=1">high rated post</a> in SO on <code>unicodes</code></p>
  
  <p>Here is an `illustration given there :</p>
  
  <pre><code>$ python
  
  &gt;&gt;&gt; import sys
  
  &gt;&gt;&gt; print sys.stdout.encoding
  UTF-8
  
  &gt;&gt;&gt; print '\xe9' # (1)
  é
  &gt;&gt;&gt; print u'\xe9' # (2)
  Ã©
  &gt;&gt;&gt; print u'\xe9'.encode('latin-1') # (3)
  é
  &gt;&gt;&gt;
  </code></pre>
  
  <p>and the explanation were given as </p>
  
  <blockquote>
    <p>(1) python outputs binary string as is, terminal receives it and tries to match its value with latin-1 character map. In latin-1, 0xe9 or 233 yields the character "é" and so that's what the terminal displays.</p>
  </blockquote>
  
  <p>My question is: why does the terminal match to the latin-1 character map when the <code>encoding</code> is <code>'UTF-8'</code>?</p>
  
  <p>Also when I tried </p>
  
  <pre><code>&gt;&gt;&gt; print '\xe9'
  ?
  &gt;&gt;&gt; print u'\xe9'
  é
  </code></pre>
  
  <p>I get different result for the first one than what is described above. why is this discrepancy and where does <code>latin-1</code> come to play in this picture?</p>