cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: FTP support for UTF8 characters in filename on Windows

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 17 Feb 2011 19:56:09 +0100 (CET)

On Thu, 17 Feb 2011, Vincent Lavoie wrote:

> On Windows, I'm trying to download a file that contains foreign characters
> (non-ascii) in FILENAME like « é » via CURL.EXE (v. 7.21.3) from a FTPS
> site.

Welcome into non-standard land. FTP is a dreadful protocol for anything but
plain ascii, as there are no real standards for this.

> I know that the FTP site support UTF8 and the files are listed correctly
> with another FTP program like Filezilla but I cannot find how to do that
> with CURL.EXE.

curl has no built-in support for it, you'll have to craft your own...

> curl -Q "PROT P" -ku myusername:mypassword ftps://dbs.ftpsite.com/ -l >
> dir.txt

That "PROT P" really should not be necessary...

> curl --stderr - -o ".\Inbox\%%i" -Q "PROT P" -Q "OPTS UTF8 ON" -ku
> myusername:mypassword "ftps://dbs.ftpsite.com/%%i" > error.txt

You can send "OPTS UTF8 ON" (which is the defacto way of doing this it seems,
as defined in an expired Internet-Draft from 2002:
http://tools.ietf.org/html/draft-ietf-ftpext-utf-8-option-00) like that, but
then you need to make sure that all file names you pass on to curl as sent
UTF-8 encoded and I don't see how your loop above does that. curl itself won't
utf8 encode anything since it has no knowledge about such matters.

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-02-17