javascript - Output decodeURIComponent string won't work -
in angularjs script, transform part of uri using vanillajs decodeuricomponent this:
var somevar = decodeuricomponent(uristring); //uristring = zao0%2b1 but when outputting somevar using alert() or placing in inside of input field, keep getting zao0%2b1 instead of zao0+b1 output. going on?
looks input incorrect expected result.
if take expected result , encode different value returned using input
var str = "zao0+b1"// expected output // encode var encoded = encodeuricomponent(str); console.log(encoded);// "zao0%2bb1" - differs input // decode var result = decodeuricomponent(encoded); console.log(result); // "zao0+b1" - same original , per expected result in question
Comments
Post a Comment