Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Unescaping JavaScript string (encode/decode)

by Anonymous Monk
on Mar 18, 2016 at 04:32 UTC ( [id://1158188]=note: print w/replies, xml ) Need Help??


in reply to Unescaping JavaScript string

use JavaScript::HashRef::Decode

#!/usr/bin/perl -- use strict; use warnings; use JavaScript::HashRef::Decode qw/ decode_js /; my $string = q{'https\x3a\x2f\x2fexample.com'}; my $js_hash = "{it:$string}";; my $fromJs = decode_js( $js_hash ) ; dd( $string, $js_hash, $fromJs ); dd( $fromJs->{it} ); __END__ ( "'https\\x3a\\x2f\\x2fexample.com'", "{it:'https\\x3a\\x2f\\x2fexample.com'}", { it => "https://example.com" }, ) "https://example.com"

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1158188]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-19 03:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found