cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Why URL encoding takes place in different ways in Linux and in Windows?

From: Ray Satiro via curl-users <curl-users_at_cool.haxx.se>
Date: Fri, 1 Apr 2016 03:00:07 -0400

On 3/30/2016 11:27 PM, kme wrote:
> Command in Linux:
>
> curl --verbose --insecure --get --data-urlencode text=привет --url https://yandex.ru/search/
>
> command output:
>
>> GET /search/?text=%D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82 HTTP/1.1
>> User-Agent: curl/7.26.0
>> Host: yandex.ru
>> Accept: */*
> .................
> .................
>
>
>
> Command in Windows:
>
> curl.exe --verbose --insecure --get --data-urlencode text=привет --url https://yandex.ru/search/
>
> command output:
>
>> GET /search/?text=%EF%F0%E8%E2%E5%F2 HTTP/1.1
>> User-Agent: curl/7.40.0
>> Host: yandex.ru
>> Accept: */*
> .................
> .................
>
>
> Why URL encoding takes place in different ways in Linux and in Windows?

This sounds like issue 345 [1]. Windows natively uses UTF-16 to encode
Unicode, so the preferred way to handle Unicode encoding in Windows is
wide characters, however it would require a lot of changes to curl and
libcurl to support that. Windows also supports characters encoded using
local code pages (known as misleading "ANSI"). They have UTF-8 as a code
page but it doesn't work very well (see the issue), for example you
can't set the locale of a program to UTF-8.

[1]: https://github.com/curl/curl/issues/345

-------------------------------------------------------------------
List admin: https://cool.haxx.se/list/listinfo/curl-users
FAQ: https://curl.haxx.se/docs/faq.html
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2016-04-01