1

I have an object with a value that has spaces in it, and it gets replaced with an encoded string, like:

alldata["test"] will return "Long+name" or something like alldata["test"] will return "%BLong+name%B"

when it's set by using

alldata["test"] = "Long name" (or "[Long name]") via a series of code.

Am I missing something? I don't think using $.toEvalJSON is the right way to go because I haven't transformed the object into JSON. I'd rather not do a string.replace either because I'd have to capture every possible type of input that is encoded.

Thank you!

2 Answers 2

1

If your question is how to remove the encoding, you could always use

unescape(s)

See Escape and Unescape Functions

Sign up to request clarification or add additional context in comments.

Comments

0

The issue is related to the fact that I failed to mention that the object was being assigned the string as a result of a .serialize() command. Hence a urldecode() will work perfectly.

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.