8

I have a value that I pass on to URL parameter the original value looks like this:

1436641259169/nDfmDmVa

when it gets passed on it converts it to this:

1436641259169%252FnDfmDmVa

So, how to do I convert it back when I pull it down?

0

2 Answers 2

14

This may help you: decodeURIComponent

decodeURIComponent(string);

Example:

decodeURIComponent(decodeURIComponent("1436641259169%252FnDfmDmVa"))
> "1436641259169/nDfmDmVa"
Sign up to request clarification or add additional context in comments.

4 Comments

You might explain why you're decoding it twice. In any case, the OP's original is very string. decodeURIComponent might be part of the answer, but not the whole answer.
@T.J.Crowder Um, yes though it is kind of weird that I need to pass it through twice. The question definitely says decoding URL parameter but the string in the question is not actually correct.
@teddybear123 It should work according to your question. If not, you might want to be a little bit more detailed on what the conversion is. decodeURIComponent is supposed to, well, decode URI components.
@teddybear123: "Didn't work" is not a useful problem statement.
0

I think this will help you to decode the url :

  decode(content: string){
    return decodeURIComponent(content);
  }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.