title: Uploading files from a Cyrillic path using pycurl
body: <p>I've recently designed an upload dialog backed by PyCURL which I'm using in a few of my applications.<br>
  I have run into an issue when setting pycurl's HTTPPOST option. I am setting it like so:<br>
      self.curl.setopt(self.curl.HTTPPOST, [(field, (self.curl.FORM_FILE, filename))])<br>
  If filename is a string, all is fine. If I pass it a unicode, however, it raises a TypeError.
  Is there any way for me to be able to give it a Cyrillic path? I tried UTF-8 encoding it, but that was unsuccessful.
  Thank you for your time</p>
  
  <p>Update:</p>
  
  <p>I'm actually getting the filename from a WX control, so it's unicode before I even touch it. When I then encode it to UTF-8, (using filename = filename.encode('UTF-8')) the setopt goes fine but everything blows up on perform:</p>
  
  <pre><code>* About to connect() to example.com port 80 (#0)
  *   Trying 123.123.123.123... * connected
  * Connected to example.com (123.123.123.123) port 80 (#0)
  * failed creating formpost data
  * Connection #0 to host example.com left intact
  Traceback (most recent call last):
    File "c:\python27\lib\site-packages\transfer_dialogs-0.28-py2.7.egg\transfer_dialogs\transfer_dialogs.py", line 64, in perform_transfer
      self.curl.perform()
  error: (26, 'failed creating formpost data')
  </code></pre>
  
  <p>Update 2:</p>
  
  <p>As requested, a bit more data.  filename contains the result of a GetValue() from the open dialog.<br>
      logging.debug("Filename: %r encoded filename: %r" % (filename, filename.encode('UTF-8')))<br>
  result:<br>
      Sat Feb 05, 2011 03:33:56 core.dialogs.upload_audio DEBUG: Filename: u'C:\Users\Q\test\\u0422\u0435\u0441\u0442\u043e\u0432\u0430\u044f \u043f\u0430\u043f\u043a\u0430\test.mp3' encoded filename: 'C:\Users\Q\test\\xd0\xa2\xd0\xb5\xd1\x81\xd1\x82\xd0\xbe\xd0\xb2\xd0\xb0\xd1\x8f \xd0\xbf\xd0\xb0\xd0\xbf\xd0\xba\xd0\xb0\test.mp3'</p>