Below are the methods that deal with the encoding/decoding So I'm calling handleRequest($fun,$parameters) from my cgi file which calls a Handler.pm which initially does an eval call to handleRequest which firstly does eval call looks like this:
sub handle_req_cgi{ eval { $log->info("pjb.cgi - Started function $function , user: $user_ +name"); $msg = UI::PJB::handleRequest($function, $parameters); 1; } //Response $tx->res->code($res_code); $tx->res->headers->content_type('application/json'); $tx->res->body(encode('UTF-8',$msg)); #THIS IS THE LINE which corrupts the msg but if I print just the msg w +ithout encode then #wide character warning is thrown by Mojo $tx->rendered; }
handleRequest() # looks like this: { $jsonDecodedParameters = $J->decode($parameters); my $result = executeFunction($fun, $jsonDecodedParameters); if(ref $result eq ref {} && defined $result->{$HTTP_REQUEST_REDIRECT_U +RL_KEY}) { $jsonEncodedResult = $J->encode($result); returns this $jsonEncodedResult }
then the control inside Handler.pm proceeds to write the response of
In reply to Re^3: Encoding/decoding for korean strings
by siva_pm
in thread Encoding/decoding for korean strings
by siva_pm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |