comparison lib/js/urweb.js @ 1259:83b1853d1e58

URL-escape with '.' instead of '%', to avoid confusing proxies
author Adam Chlipala <adamc@hcoop.net>
date Tue, 18 May 2010 14:47:56 -0400
parents 26fed2c4f5be
children 25ebd8c4fafb
comparison
equal deleted inserted replaced
1258:78b36c50daf9 1259:83b1853d1e58
590 } 590 }
591 591
592 function uf(s) { 592 function uf(s) {
593 if (s.length == 0) 593 if (s.length == 0)
594 return "_"; 594 return "_";
595 return (s.charAt(0) == '_' ? "_" : "") + encodeURIComponent(s); 595 s = s.replace(new RegExp ("\\.", "g"), ".2E");
596 return (s.charAt(0) == '_' ? "_" : "") + encodeURIComponent(s).replace(new RegExp ("%", "g"), ".");
596 } 597 }
597 598
598 function uu(s) { 599 function uu(s) {
599 if (s.length > 0 && s.charAt(0) == '_') { 600 if (s.length > 0 && s.charAt(0) == '_') {
600 s = s.substring(1); 601 s = s.substring(1);
601 } else if (s.length >= 3 && s.charAt(0) == '%' && s.charAt(1) == '5' && (s.charAt(2) == 'f' || s.charAt(2) == 'F')) 602 } else if (s.length >= 3 && (s.charAt(0) == '%' || s.charAt(0) == '.')
602 s = s.substring(3); 603 && s.charAt(1) == '5' && (s.charAt(2) == 'f' || s.charAt(2) == 'F'))
603 return decodeURIComponent(s.replace(new RegExp ("\\+", "g"), " ")); 604 s = s.substring(3);
605 s = s.replace(new RegExp ("\\+", "g"), " ");
606 s = s.replace(new RegExp ("\\.", "g"), "%");
607 return decodeURIComponent(s);
604 } 608 }
605 609
606 function atr(s) { 610 function atr(s) {
607 return s.replace(new RegExp ("\"", "g"), "&quot;").replace(new RegExp ("&", "g"), "&amp;") 611 return s.replace(new RegExp ("\"", "g"), "&quot;").replace(new RegExp ("&", "g"), "&amp;")
608 } 612 }