cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: Curl --data-urlencode posts broken non-English characters

From: Jon Seymour <jon.seymour_at_gmail.com>
Date: Mon, 1 Feb 2016 12:01:26 -0500

The problem is likely that curl is running with a non-UTF8 char set locally so is interpreting the UTF-8 bytes of your file as, say ISO-8859 characters. Not sure if this will help, but you might try using LC_ALL environment variable to alter the effective charset of your curl client.

> On 1 Feb 2016, at 10:18, Irvin Jacob <nivribocaj_at_gmail.com> wrote:
>
> I am using curl to reply to a topic in a vBulletin forum from a text file.
>
> My command looks like this:
>
> curl -b "cookies.txt" -d "title=" --data-urlencode "message_backup@message.txt" --data-urlencode "message@message.txt" -d "wysiwyg=0" -d "iconid=0" -d "s=" ... "http://somesite.com/newreply.php?do=postreply&t=something" -L
>
> Note that I just wrote "..." above because the command is too long.
>
> message.txt has Japanese text "大日本帝國" inside and it is encoded in UTF-8. Curl successfully posted the message but the Japanese characters turned into "大日本å¸åœ‹" in my message posted on the forum. Other normal (ASCII) characters look fine though. I also tried other foreign characters like Greek letters and accented letters. "Thére Àre sôme spëcial charâcters ïn thìs têxt" became "Thére Àre sôme spëcial charâcters ïn thìs têxt"
>
> I tried specifying the header Content-Type: application/x-www-form-urlencoded; charset=UTF-8 via -H option. I tried adding --compressed and --tr-encoding options. I also tried different versions of curl. All of these did not change anything.
>
> Could somebody please help me?
>
> --
> Irvin
>
> This email has been sent from a virus-free computer protected by Avast.
> www.avast.com
> -------------------------------------------------------------------
> 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

-------------------------------------------------------------------
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 2016-02-01