title: Django shell encoding error (Debian only, Ubuntu fine)
body: <p>Good day</p>
  
  <p>Can somebody explain what is going on behind the Django manage.py shell console?
  The problem is following. I'm developing a Django app, which is using an urllib to parse some html pages to get some info from them. And that info is in russian language, so it should be unicode (this is address string in this case). Next, my script feeds this to some other third-party module which falls, because it is not valid unicode string (I'm trying to geodecode point from address).
  I tried to print the string (parsed address in this case) to console with <code>print address</code> command but it fails:</p>
  
  <pre><code>File "&lt;console&gt;", line 1, in &lt;module&gt;
  ... some useless stacktrace ...    
      print address
  UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-1: ordinal not in range(128)
  </code></pre>
  
  <p>Now comes the interesting part.<br>
  I have 2 computers: workstation with Ubuntu and Python 2.7.2 and Debian Lenny VPS with Python 2.7.2. I start parser the same way on both machines: by executing <code>python manage.py shell</code> and calling my function from it.<br>
  First I got the same error on both installations, but then I noticed that my python encoding is set to 'ascii' (<code>import sys; sys.getdefaultencoding()</code>). And when I put </p>
  
  <pre><code>import sys; reload(sys).setdefaultencoding('utf-8')
  </code></pre>
  
  <p>into settings.py the problem solves for Ubuntu. Now I get proper print on it, e.g. <code>г. Челябинск, ул. Кирова, д. 27, КТК Набережный</code>, but this is not working for Debian.</p>
  
  <p>If i delete this <code>print address</code> string than, I get non-readable geolocation errors, but again - only on Debian. Ubuntu is working just fine:</p>
  
  <pre><code>Failed to geodecode address [Ð³. Ð§ÐµÐ»ÑÐ±Ð¸Ð½ÑÐº, ÑÐ». 1-Ð¾Ð¹ ÐÑÑÐ¸Ð»ÐµÑÐºÐ¸, 17/1, ÑÑÐ½Ð¾Ðº ÐÑÑÐ°Ðº, 1-Ð·]
  </code></pre>
  
  <p>No amount of <code>unicode(address).encode('utf-8')</code> magic can help this.</p>
  
  <p>So I just can't get it. What's the differences between machines that cause me so much trouble?</p>