Question for Web Developers

Started by shadowlight, January 09, 2012, 07:14:32 AM

Previous topic - Next topic

shadowlight

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

BobM

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
Laugh and the world laughs with you. Cry and you'll have  to blow your nose.

Barry (NJ)

What's generating the code, and by 'escape' do you mean replace with spaces or remove?
Happiness is when your system overcomes your nervosa ;) 
So much media, so little time... My Media Room...

shadowlight

Quote from: 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?

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.

Barry (NJ)

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 ;)
Happiness is when your system overcomes your nervosa ;) 
So much media, so little time... My Media Room...

machinehead

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
Its cool ndude.