Changeset 2515 for trunk/expressoMail1_2/js/common_functions.js
- Timestamp:
- 04/14/10 10:05:18 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/js/common_functions.js
r2497 r2515 598 598 599 599 function url_encode(str){ 600 var hex_chars = "0123456789ABCDEF"; 601 var noEncode = /^([a-zA-Z0-9\_\-\.])$/; 602 var n, strCode, hex1, hex2, strEncode = ""; 603 604 for(n = 0; n < str.length; n++) { 605 if (noEncode.test(str.charAt(n))) { 606 strEncode += str.charAt(n); 607 } else { 608 strCode = str.charCodeAt(n); 609 hex1 = hex_chars.charAt(Math.floor(strCode / 16)); 610 hex2 = hex_chars.charAt(strCode % 16); 611 strEncode += "%" + (hex1 + hex2); 612 } 613 } 614 return strEncode; 600 return escape(str); 615 601 } 616 602 617 603 function url_decode(str) { 618 619 var n, strCode, strDecode = ""; 620 for (n = 0; n < str.length; n++) { 621 if (str.charAt(n) == "%") { 622 strCode = str.charAt(n + 1) + str.charAt(n + 2); 623 strDecode += String.fromCharCode(parseInt(strCode, 16)); 624 n += 2; 625 } else { 626 strDecode += str.charAt(n); 627 } 628 } 629 return strDecode; 604 return unescape(str); 630 605 } 631 606
Note: See TracChangeset
for help on using the changeset viewer.