curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Does curl do anything special with non-ASCII characters in HTTP header values?

From: Paul Gilmartin via curl-users <curl-users_at_cool.haxx.se>
Date: Sat, 19 Sep 2020 10:22:39 -0600

On 2020-09-19, at 09:59:42, Dan Fandrich via curl-users <curl-users_at_cool.haxx.se> wrote:
>
> On Sat, Sep 19, 2020 at 12:19:57AM +0000, Steve Perkins via curl-users wrote:
>>
>>
>> curl --request POST --header "my-header: ΓΈ" --data "dummy payload" http://
>> localhost:8080/my-endpoint
>
> To curl, the value of the --header option is an opaque series of bytes which it
> sends along. The bytes you pass it in this case are in whatever your local
> character set is, probably UTF-8, but it might be ISO 8859/1 or something else.
> Whatever it is, it sounds like that's what the server wants.
>
Yes. Steve appears to be using curl to verify the behavior
of another utility. Curl passes; the other utility fails.

> ...
> Other clients are probably sending other bytes for that header. Are they
> hard-coded in a source code file? Maybe that source code file is in a different
> character set than the command-line you use. The program may need to perform a
> character set conversion (using iconv(3) or similar) before sending the bytes
> to the server.
>
A conventional encoding (RFC 1738; UTF-8) of the filename above would be:
    "my-header:%20%c3%b8"

-- gil

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-09-19