DrDOS
09-16-2010, 05:17 AM
Uses JS to generate a display of escape code characters.
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript">
//Alerts to errors.
window.onerror=function(msg, url, linenumber){var logerror='Error message: ' + msg + '. Url: ' + url + 'Line Number: ' + linenumber;alert(logerror);return false}
</script>
<title>Escape codes.</title>
<meta http-equiv="Content-Style-Type" content="text/css" />
<style type="text/css">
<!--
body{width:600px;margin-left:auto;margin-right:auto;text-align:center;color:#fff;background-color:#333}
h3 {color:white}
div{border:0px solid White;}
table{background-color:#333;width:100%;border-collapse:collapse;margin:0px}
td{border:2px solid red;background-color:Beige;color:#000;border-color:red;height:2em;color:#003;font-family:monospace;font-size:1em;font-weight:normal;text-align:center}
-->
</style>
</head>
<body><div>
<h3>URL and HTML Escape Codes<br><br>URL Hexadecimal Escape Codes</h3>Automatically generated with ECMA script.<br />Character %20 is a space, %7f a control character. <br />
Legend: Character, decimal value, escape code.<br /><br />
<table id="url-escapes"><tr></tr></table>
<h3>HTML Decimal Escape Codes</h3>Automatically generated with ECMA script.<br />
Character 32 is a space. <br />Characters 129,141,143,144 and 157 are control characters.<br />
Legend: Character, escape code.<br /><br />
<table id="html-escapes"><tr></tr></table>
</div>
<script type="text/ecmascript">
var n = 32;
var urlblock = "";
var htmlblock = "";
do
{
if ( n < 128 ){
var j = n.toString(16); var s = unescape("%"+j);
if ( n%4 == 3 ){urlblock = urlblock + "<td>"+s+" "+n+" %"+j+"<\/td>\n<\/tr><tr>\n";}
else urlblock = urlblock + "<td>"+s+ " "+n+" %"+j+"<\/td>\n"; }
if ( n%4 == 3 ){htmlblock = htmlblock + "<td>&#"+n+ "; &#"+n+";<\/td>\n<\/tr><tr>\n";}
else htmlblock = htmlblock + "<td>&#"+n+ "; &#"+n+";<\/td>\n";
n++
}while ( n < 512 )
document.getElementById("url-escapes").innerHTML="<table><tbody><tr>\n"+urlblock;
document.getElementById("html-escapes").innerHTML="<table><tbody><tr>\n"+htmlblock;
</script>
</body>
</html>
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript">
//Alerts to errors.
window.onerror=function(msg, url, linenumber){var logerror='Error message: ' + msg + '. Url: ' + url + 'Line Number: ' + linenumber;alert(logerror);return false}
</script>
<title>Escape codes.</title>
<meta http-equiv="Content-Style-Type" content="text/css" />
<style type="text/css">
<!--
body{width:600px;margin-left:auto;margin-right:auto;text-align:center;color:#fff;background-color:#333}
h3 {color:white}
div{border:0px solid White;}
table{background-color:#333;width:100%;border-collapse:collapse;margin:0px}
td{border:2px solid red;background-color:Beige;color:#000;border-color:red;height:2em;color:#003;font-family:monospace;font-size:1em;font-weight:normal;text-align:center}
-->
</style>
</head>
<body><div>
<h3>URL and HTML Escape Codes<br><br>URL Hexadecimal Escape Codes</h3>Automatically generated with ECMA script.<br />Character %20 is a space, %7f a control character. <br />
Legend: Character, decimal value, escape code.<br /><br />
<table id="url-escapes"><tr></tr></table>
<h3>HTML Decimal Escape Codes</h3>Automatically generated with ECMA script.<br />
Character 32 is a space. <br />Characters 129,141,143,144 and 157 are control characters.<br />
Legend: Character, escape code.<br /><br />
<table id="html-escapes"><tr></tr></table>
</div>
<script type="text/ecmascript">
var n = 32;
var urlblock = "";
var htmlblock = "";
do
{
if ( n < 128 ){
var j = n.toString(16); var s = unescape("%"+j);
if ( n%4 == 3 ){urlblock = urlblock + "<td>"+s+" "+n+" %"+j+"<\/td>\n<\/tr><tr>\n";}
else urlblock = urlblock + "<td>"+s+ " "+n+" %"+j+"<\/td>\n"; }
if ( n%4 == 3 ){htmlblock = htmlblock + "<td>&#"+n+ "; &#"+n+";<\/td>\n<\/tr><tr>\n";}
else htmlblock = htmlblock + "<td>&#"+n+ "; &#"+n+";<\/td>\n";
n++
}while ( n < 512 )
document.getElementById("url-escapes").innerHTML="<table><tbody><tr>\n"+urlblock;
document.getElementById("html-escapes").innerHTML="<table><tbody><tr>\n"+htmlblock;
</script>
</body>
</html>