title: Python Django: displaying special characters in admin, but not on my site?
body: <p><strong>Using the admin:</strong></p>
  
  <p>I can put characters like this: <code>«æšʩЖあ☃»</code> into a textfield.
  And those characters will then display correctly on the admin sidebar as "recent actions".</p>
  
  <p>This tells me that there is someway that django is querying my database where these characters are being stored correctly and then represented correctly.</p>
  
  <p><strong>Using Views.py</strong>
  If I do something like this in views.py:</p>
  
  <pre><code>var = '«æšʩЖあ☃»'
  render_to_response( ... bla bla bla
  {'var':var} .. bla bla...)
  </code></pre>
  
  <p>It shows up correctly on my webpage. </p>
  
  <p><strong>However</strong>
  In my django app I have some manual connections going on to the database, written like so:
  <strong>myscript.py</strong></p>
  
  <pre><code>con = mdb.connect('mysql.server','name','password','mydb')
  cur = con.cursor(mdb.cursors.DictCursor)
  cur.execute(
              """SELECT * FROM swimsets_swimset"""
              )
  container = cur.fetchone
  myquery = container['column-name']
  
  mylist.append(myquery)
  </code></pre>
  
  <p><strong>views.py</strong></p>
  
  <pre><code> var = myscript.myfunction() # returns the mylist shown above
     render_to_response(...{'var':var}...)
  </code></pre>
  
  <p>It will however show the the list on the page as [ \x8890\x923\ etc, \1313\23x\ etc ]
  and then if I print each item of the list, show absolutely nothing. </p>
  
  <p><strong>What I've tried:</strong></p>
  
  <p>Adding:    <code>con = mdb.connect('mysql.server','name','password','mydb',use_unicode=True, charset='utf8')</code></p>
  
  <p>adding: <code># -*- coding: utf-8 -*-</code> (to views and myscript.py)
  adding: DEFAULT_CHARSET = 'UTF-8' (to settings.py)</p>
  
  <p>I've read countless stacks and lots of documentation but I still just cant get it. Thanks appreciated.
  <a href="https://stackoverflow.com/questions/20714517/python-django-encoding-error-non-ascii-character-xe5">Python Django Encoding Error, Non-ASCII character &#39;\xe5&#39;</a></p>
  
  <p>If I do this:
      var.decode('iso-8859-1').encode('utf-8')</p>
  
  <p>It seems to display SOME of the odd characters, but it isn't really a fix. I doubt this is how django is able to correctly display all sorts of unicode in the admin side panel. </p>
  
  <p>Thank you</p>