Use a url encoding mechanism on the entire second URL.
For instance in PHP you'd use: urlencode(), urldecode()
If you're doing this client-side with JavaScript then the escape / unescape / encodeURI / decodeURI / encodeURIComponent / decodeURIComponent methods would be used, depending on platform and encoding needs.
The second URL might have URL encoded characters already, no worries though, if using PHP each will be encoded again, decode the entire URL string, then decode each individual value, where necessary. If using JavaScript you'll need to use the escape method twice, or the encodeURI method for the first encoding, then encodeURIComponent for the entire URL.
Here's a brief demonstration:
Code:
<?php
$url = urlencode('http://localhost/mypage?param=thing&otherparam=otherthing&three=three+four');
// Whole URL
echo 'http://localhost/mypage?one=one&two='.$url.'<br />';
// Just the second URL decoded
echo urldecode($url).'<br />';
?>
Outputs:
http://localhost/mypage?one=one&two=...3Dthree%2Bfour
http://localhost/mypage?param=thing&...ree=three+four
: )
Rich
::::::::::::::::::::::::::::::::::::::::::
The Spicy Peanut Project
http://www.spicypeanut.net
::::::::::::::::::::::::::::::::::::::::::