good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
How to set charset when POSTing?by vr (Curate) |
on Jul 29, 2021 at 21:03 UTC ( [id://11135500]=perlquestion: print w/replies, xml ) | Need Help?? |
vr has asked for the wisdom of the Perl Monks concerning the following question: I'm afraid this question is OT -- not really Perl, but web basics. With WWW::Mechanize, I could get the form from page with e.g. form_name, then just set required charset (accept_charset) and then it all "automatically" worked as expected: set input fields text values (field) using usual "normal" (Unicode) Perl strings, click submit button, and job's done. Now I'm moving from WWW::Mechanize to Net::Async::HTTP, its POST method accepts array reference of "field_name" => "value" pairs. Here I tried different combinations of encoding text field values (or not encoding at all) and also providing things like
as additional %args to POST, but to no avail: reading back what I posted, from server, I'm getting different sorts of garbage, double-encoded text from what I guess. How to POST text with correct charset? I suspect the answer to this is very simple and obvious to anyone with basic knowledge of web technologies, but not to me, alas. 5 min edit: the charset to use is actually "koi8-r"; that's what server expects, what's working with WWW:Mechanize, and what I'm trying (but no success) with Net::Async::HTTP in the 1st place.
Back to
Seekers of Perl Wisdom
|
|