How to post non-latin1 data to non-UTF8 site using perl?
- by ZyX
I want to post russian text on a CP1251 site using LWP::UserAgent and get following results:
$text="??????? ?????";
FIELD_NAME => $text # result: ??? ?'???'???'?????????????? ?'?'?????????'???'?'
$text=Encode::decode_utf8($text);
FIELD_NAME => $text # result: ? ???????????? ?'???????'
FIELD_NAME => Encode::encode("cp1251", $text) # result: ?????+?+?????? ???????+??
FIELD_NAME => URI::Escape::uri_escape_utf8($text) # result: D0%a0%d1%83%d1%81%d1%81%d0%ba%d0%b8%d0%b9%20%d1%82%d0%b5%d0%ba%d1%81%d1%82
How can I do this? Content-Type must be x-www-form-urlencoded. You can find similar form here, but there you can just escape any non-latin character using &#...; form, trying to escape it in FIELD_NAME results in 10561091108910891 10901077108210891 (every &, # and ; stripped out of the string).