It sounds like there is some encoding being done by the server somewhere. In php you can use the htmlentities() function to encode the values. This should allow the link to be written in a way that will still get you to the correct file.
<?php echo htmlentities($your_link); ?>
Here is a link to the php page for this function:
php.net/htmlentities