AudioNervosa

Systemic Development => Digital Audio Devices => Hardware => Topic started by: shadowlight on January 09, 2012, 07:14:32 AM

Title: Question for Web Developers
Post by: shadowlight on January 09, 2012, 07:14:32 AM
Not 100% sure if it is the right location.  If not please feel free to move it to the right location.

I am not a web developer hence the question.

I currently have the following code and I need to figure out a way to escape special character's in the code.

<a href="http://10.7.2.202:81/dvwl?p1=$(url.host)&p2=$(cs-categories)">Restore access to site</a>

The url.host and cs-categories are dynamically created and the cs-categories variable is likely to have special characters like "/" and ";" which I would like to escape.

TIA
Title: Re: Question for Web Developers
Post by: BobM on January 09, 2012, 07:16:59 AM
You might want to ping Mike Cullinan directly. He's an expert on these things. Here's a link to his site:

www.mentalpixel.com
Title: Re: Question for Web Developers
Post by: Barry (NJ) on January 09, 2012, 07:24:22 AM
What's generating the code, and by 'escape' do you mean replace with spaces or remove?
Title: Re: Question for Web Developers
Post by: shadowlight on January 09, 2012, 07:33:09 AM
What's generating the code, and by 'escape' do you mean replace with spaces or remove?

I will take any option: replace with space or remove or just change "/" to %2F.  The url.host and cs-categories is being generated by Bluecoat proxy server.
Title: Re: Question for Web Developers
Post by: Barry (NJ) on January 09, 2012, 07:56:25 AM
Sorry, I'm not familiar with Bluecoat, your best bet is to get a hold of Mike, I'll send him a note to point him here ;)
Title: Re: Question for Web Developers
Post by: machinehead on January 09, 2012, 08:57:43 AM
Im not so technical.. well I know some things.. ;)

Try this:
http://www.webtoolkit.info/javascript-url-decode-encode.html


http://us3.php.net/urlencode
http://msdn.microsoft.com/en-us/library/ms525738
http://docstore.mik.ua/orelly/perl/perlnut/c17_110.htm

javascript:

function TestEncoding()                   
{                   
  var inputString=document.forms["TestEncodingForm"]["inputString"].value;
  var encodedInputString=escape(inputString);
  encodedInputString=encodedInputString.replace("+", "%2B");
  encodedInputString=encodedInputString.replace("/", "%2F");
  document.forms["TestEncodingForm"]["encodedInputString"].value=encodedInputString;
}

May help...
Let me know..
Mike
http://www.mentalpixel.com