curl-and-python

Re: Uploading files with UTF-8 names

From: Andre Polykanine <andre_at_oire.org>
Date: Mon, 10 Jun 2013 01:01:45 +0300

Hello Daniel,

Sorry for being so stupid, but...
  self.curl.setopt(self.curl.HTTPPOST, [(field, (self.curl.FORM_FILE, local_filename, self.curl.FORM_FILENAME, filename))])

As for now, filename is of type unicode. Local_filename =
filename.encode("utf8").
And it still throws an error 26. What am I doing wrong?

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion
------------ Original message ------------
From: Daniel Stenberg <daniel_at_haxx.se>
To: curl with python
Date created: , 12:38:02 AM
Subject: Uploading files with UTF-8 names
      On Sun, 9 Jun 2013, Andre Polykanine wrote:
> but I was suggested to write to a mailing list
For help with anything curl or libcurl, the mailing lists are certainly way 
better than stackoverflow to get accurate answers.
> The thing is that I can't upload a file that has in its name letters not 
> being in the encoding that is set for non-unicode programs in Windows.
You need to separate the name of the local file and the name as you want it to 
appear to the other side.
With libcurl's curl_formadd() function you provide the local file name to 
CURLFORM_FILE but you can then provide whatever file name you want it to have 
in the CURLFORM_FILENAME option - completely independent from what the local 
name is.
-- 
  / daniel.haxx.se
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2013-06-10