Hi,
I'm having problems decoding the britsh pound sign (£) in Mojolicious.
I'm making an ajax PUT request and my js is something like this:
...
method: "PUT",
dataType: "json",
contentType: "application/json; charset=utf-8",
data: function ( d ) {
return encodeURIComponent(JSON.stringify( d.data ));
}
I am using encodeURIComponent to deal with &. The £ gets encoded as %C2%A3.
In Mojolicious I am using:
my $json = $self->req->json;
$json->{data} = url_unescape $json->{data};
$json->{data} = decode_json $json->{data};
Dumping the data shows that the pound sign is being decoded as £.
I've tried using:
my $json = url_unescape $json->{data};
$json = decode_json $t->encode('UTF-8');
Still no luck. Can someone tell me how I should decode/encode this
correctly please?
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.