cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: How to handle non-ASCII characters in URLs

From: G. T. Stresen-Reuter <tedmasterweb_at_gmail.com>
Date: Fri, 9 Jan 2009 19:10:41 +0000

On Jan 9, 2009, at 6:50 PM, Dan Fandrich wrote:

> On Fri, Jan 09, 2009 at 05:50:50PM +0000, G. T. Stresen-Reuter wrote:
>> If I am trying to delete a file named "espaņa.txt", what would the
>> curl
>> command look like?
>>
>> curl -u "user:password" "ftp://domain.com/espa%f1a.txt" -Q "dele /
>> espaņa.txt"
>>
>> The above returns a FTP 550 error.
>>
>> I assume the "ņ" needs to be percent encoded, but I was hoping for
>> some
>> confirmation/enlightenment before heading down that path with my
>> script.
>
> RFC2640 standardizes internationalized pathnames for FTP and states
> that
> compliant servers will support UTF-8. This means that the URL
> ftp://domain.com/espa%c3%b1a.txt will work for those servers.
> Noncompliant
> servers could user other encodings. For ISO-8859-1, the URL
> ftp://domain.com/espa%f1a.txt should work. Some servers could
> support detect
> the coding and support both.
>
>>
> Dan
>

Thanks for the pointer. This was what I was expecting, so I tried the
%c3%b1 version and got the following response:

> dele /httpdocs/samples/espa%c3%b1a.txt
< 550 /httpdocs/samples/espa%c3%b1a.txt: No such file or directory
* QUOT command failed with 550

Since I'm running this from a script and the file name is coming in
through a parameter, I also tried the command directly from my
terminal with no luck.

Maddeningly my FTP client (CyberDuck) handles such situations just
fine, without a hitch. Wish I knew more about this stuff...

Is there any way to tell what encoding the server is using?

Thanks again for your help.

Ted S-R

-------------------------------------------------------------------
List admin: http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-01-09