title: Encoding characters with ISO 8859-1 in Python
body: <p>With <code>ord(ch)</code> you can get a numerical code for character <code>ch</code> up to <code>127</code>. Is there any function that returns a number from 0-255, so to cover also <code>ISO 8859-1</code> characters?<br>
  <strong>Edit:</strong> Follows my last version of code and error I get</p>
  
  <pre><code>#!/usr/bin/python
  # coding: iso-8859-1
  
  import sys
  reload(sys)
  sys.setdefaultencoding('iso-8859-1')
  print sys.getdefaultencoding()  # prints "iso-8859-1" 
  
  def char_code(c):
      return ord(c.encode('iso-8859-1'))
  print char_code(u'à')
  </code></pre>
  
  <p>I get an error:
  TypeError: ord() expected a character, but string of length 2 found</p>