perl - Getting UTF-8 Request Parameter Strings in mod_perl2 -


i'm using mod_perl2 website , use cgi::apache2::wrapper request parameters page (e.g. post data). i've noticed string $req->param("parameter") function returns not utf-8. if use string as-is can end garbled results, need decode using encode::decode_utf8(). there anyway either parameters decoded utf-8 strings or loop through parameters , safely decode them?

to parameters decoded, need override behaviour of underlying class apache2::request libapreq2, losing xs speed advantage. not straightforward possible, unfortunately sabotaged cgi::apache2::wrapper constructor:

unless (defined $r , ref($r) , ref($r) eq 'apache2::requestrec') { 

this wrong oo programming, should say

… $r->isa('apache2::requestrec') 

or perhaps forego class names altogether , test behaviour (… $r->can('param')).

i say, obstacles, it's not worth it. recommend keep existing solution decodes parameters explicitly. it's clear enough.

to loop on request parameters, not pass argument param method , list of names. documented (1, 2), please read more carefully.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -