diff 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
line wrap: on
line diff
--- a/lib/js/urweb.js	Sun May 16 18:25:00 2010 -0400
+++ b/lib/js/urweb.js	Tue May 18 14:47:56 2010 -0400
@@ -592,15 +592,19 @@
 function uf(s) {
   if (s.length == 0)
     return "_";
-  return (s.charAt(0) == '_' ? "_" : "") + encodeURIComponent(s);
+  s = s.replace(new RegExp ("\\.", "g"), ".2E");
+  return (s.charAt(0) == '_' ? "_" : "") + encodeURIComponent(s).replace(new RegExp ("%", "g"), ".");
 }
 
 function uu(s) {
   if (s.length > 0 && s.charAt(0) == '_') {
     s = s.substring(1);
-  } else if (s.length >= 3 && s.charAt(0) == '%' && s.charAt(1) == '5' && (s.charAt(2) == 'f' || s.charAt(2) == 'F'))
-    s = s.substring(3);
-  return decodeURIComponent(s.replace(new RegExp ("\\+", "g"), " "));
+  } else if (s.length >= 3 && (s.charAt(0) == '%' || s.charAt(0) == '.')
+             && s.charAt(1) == '5' && (s.charAt(2) == 'f' || s.charAt(2) == 'F'))
+      s = s.substring(3);
+  s = s.replace(new RegExp ("\\+", "g"), " ");
+  s = s.replace(new RegExp ("\\.", "g"), "%");
+  return decodeURIComponent(s);
 }
 
 function atr(s) {