[pLog-svn] r1550 - plog/trunk/js/ui

oscar at devel.plogworld.net oscar at devel.plogworld.net
Fri Mar 18 19:24:08 GMT 2005


Author: oscar
Date: 2005-03-18 19:24:08 +0000 (Fri, 18 Mar 2005)
New Revision: 1550

Modified:
   plog/trunk/js/ui/common.js
Log:
committed a bit too much!

Modified: plog/trunk/js/ui/common.js
===================================================================
--- plog/trunk/js/ui/common.js	2005-03-18 19:22:06 UTC (rev 1549)
+++ plog/trunk/js/ui/common.js	2005-03-18 19:24:08 UTC (rev 1550)
@@ -289,8 +289,6 @@
 	return true;
 }
 
-// ====================================================================
//       URLEncode and URLDecode functions
//
// Copyright Albion Research Ltd. 2002
// http://www.albionresearch.com/
//
// You may copy these functions providing that 
// (a) you leave this copyright notice intact, and 
// (b) if you use these functions on a publicly accessible
//     web site you include a credit somewhere on the web site 
//     with a link back to http://www.albionresarch.com/
//
// If you find or fix any bugs, please let us know at albionresearch.com
//
// SpecialThanks to Neelesh Thakur for being the first to
// report a bug in URLDecode() - now fixed 2003-02-19.
// ====================================================================
function URLEncode( )
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var plaintext = document.URLForm.F1.value;
	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" 
                        + ch 
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for

	document.URLForm.F2.value = encoded;
	return false;
};
-
 function previewPost( formId )
 {
     form = document.getElementById( formId )




More information about the pLog-svn mailing list