title: Sending UTF-8 with sockets
body: <p>I'm tring to setup a little chat program in python. Everything was working fine until I
  sent a string containing a non ascii character that caused the program to crash. The string are read from a wx.TestCtrl</p>
  
  <ul>
  <li><p>How can I send a string with UTF-8 encoding over sockets? </p></li>
  <li><p>Why does the program work without problems at the start? I have set the encoding to UTF-8
  so wouldn't all character cause the program to crash?</p></li>
  </ul>
  
  <p>Here is the error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "./client.py", line 180, in sendMess
      outSock.sendto(s,self.serveraddr)
  UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 26: 
                      ordinal not in range(128)
  </code></pre>
  
  <p>Here is how I create the socket and try to send the message:</p>
  
  <pre><code>  outSock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
    ....
    outSock.sendto(s,self.serveraddr)
  </code></pre>