> From: SamCKayak
> 
> In ASP, I am building a JSON object and escape the data using
> 
> Server.URLEncode(strParmChoices)
> 
> It seems this encodes blanks as a plus sign "+".
> 
> Back in JavaScript, it looks like unescape("+") leaves the 
> plus as a plus.  I've band-aided the problem using
> 
> unescape(json.strParmChoices).replace(/\+/g, ' '); /* replace 
> all plusses with blanks */
> 
> Is there a better way to get this job done right?

No, that's completely reasonable - it's the same code I use. My only
suggestion would be to package it into a separate function, e.g.

  function unescapePlus( str ) {
      return unescape( str ).replace( /\+/g, ' ' );
  }

-Mike

Reply via email to