curl-and-python
Re: Uploading files with UTF-8 names
From: Zdenek Pavlas <zpavlas_at_redhat.com>
Date: Mon, 10 Jun 2013 07:50:45 -0400 (EDT)
Date: Mon, 10 Jun 2013 07:50:45 -0400 (EDT)
> os.stat() here doesn't work either, it says "System cannot find file
> specified", because it turns unicode chars into \xe0, \xa9 etc. in the
> path.
just use the encoded string, not unicode.
>> I'd try os.stat() for both encodings in turn, then send to pycurl
^^^^^^^^^^^^^^^^^^
for e in 'cp1251', 'utf8':
try: enc = filename.encode(e); os.stat(enc); break
except: continue
else:
raise ...
print 'using encoding', e ...
curl(enc)
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2013-06-10