title: Understanding Python Unicode and Linux terminal
body: <p>I have a Python script that writes some strings with UTF-8 encoding. In my script I am using mainly the <code>str()</code> function to cast to string. It looks like that:</p>
  
  <pre><code>mystring="this is unicode string:"+japanesevalues[1] 
  #japanesevalues is a list of unicode values, I am sure it is unicode
  print mystring
  </code></pre>
  
  <p>I don't use the Python terminal, just the standard Linux Red Hat x86_64 terminal. I set the terminal to output utf8 chars.</p>
  
  <p>If I execute this:</p>
  
  <pre><code>#python myscript.py
  this is unicode string: カラダーズ ソフィー
  </code></pre>
  
  <p>But if I do that:</p>
  
  <pre><code>#python myscript.py &gt; output
  </code></pre>
  
  <p>I got the typical error:</p>
  
  <pre><code>UnicodeEncodeError: 'ascii' codec can't encode characters in position 253-254: ordinal not in range(128)
  </code></pre>
  
  <p>Why is that?</p>