[thelist] a link question
Ray Hill
ray at opengrid.com
Mon Aug 27 14:39:38 CDT 2001
Phil Jones wrote:
> I am copying a link that has a % key in the link. When it get
> to the % it break the link and you can not get the full link
> address because of this. Is there any other way or symbol to
> use for this so you will get the full address for the link.
The % sign is used as an escape-type character in a URL. When the browser
sees a %, it replaces it and the two characters that follow it with the
character that they represent (%3F becomes ?, %26 becomes &, etc).
I threw together a quick little translator for you that will let you see the
encoded version of whatever text you type in. But the short answer is that
the escaped version for % is %25.
http://prydain.com/urlencode.php
[PHP code shown below, incase you want to reproduce this locally]
--ray
<html>
<head>
<title>URL Encoding</title>
<style>
.Header {color: #FFFFFF; font-family: Arial;}
.HeaderCell {background-color: #000000;}
P {font-family: Arial;}
</style>
</head>
<body>
<form method="post" name="encodeForm">
<div align="center"><center>
<table width="500" bordercolor="#000000" border="1" cellpadding="5"
cellspacing="0">
<tr>
<td align="center" class="HeaderCell">
<p class="Header"><b>URL Encoding</b></p>
</td>
</tr>
<tr>
<td>
<p>Enter a URL or character in the text field and click <b>Encode</b>
to see the URL-encoded version of the data you entered.</p>
<p><b>Un-Encoded:</b><br>
<input type="text" name="inputData" size="60" value="<?= $inputData;
?>">
<input type="submit" name="submit" value="Encode"></p>
<?
if ($inputData) {
// They did enter some data, so URL encode it and show it to them.
print("<p><b>URL Encoded:</b><br>");
print(urlencode($inputData));
print("</p>");
}
?>
</td>
</tr>
</table>
</center></div>
</form>
</body>
</html>
More information about the thelist
mailing list