Here is a workaround that I figured out. Since URL encoded text has “%” characters, I look for this character. If it exists, do the decoding. If not, skip decoding. Here is a simple sample code:
var input = mystate_information; if(input.indexOf('%') != -1) input = aDecodeFunction(mystate_information)
Do you know of a corner case that this might not work? Or do you have a smarter idea?