our $ua = LWP::UserAgent->new;
my $response = $ua->get($url);
if($response->is_success) {
my $perl_hash_or_arrayref = decode_json(encode("UTF-8", $response->decoded_content));
The above code converts the response to UTF-8 encoding,without the need to tell it which encoding the response is using.
I asume this may fail under certain cases.
How can I explicitly tell LWP::UserAgent the response encoding?
See the docs for
decoded_contentinHTTP::Message: