* looking for arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-714 to compare with
* comparing to arch@arch.thinkmo.de--2003-archives/moin--main--1.3--patch-714
M  MoinMoin/wikiutil.py

* modified files

--- orig/MoinMoin/wikiutil.py
+++ mod/MoinMoin/wikiutil.py
@@ -6,7 +6,7 @@
     @license: GNU GPL, see COPYING for details.
 """
     
-import os, re, difflib
+import os, re, difflib, urllib
 
 from MoinMoin import util, version, config
 from MoinMoin.util import pysupport
@@ -98,41 +98,21 @@
 # FIXME: better name would be quoteURL, as this is useful for any
 # string, not only wiki names.
 def quoteWikinameURL(pagename, charset=config.charset):
-    """
-    Return a simple encoding of filename in plain ascii.
+    """ Return a url encoding of filename in plain ascii
 
     Warning: will raise UnicodeError if pagename can not be encoded
     using charset. The default config.charset, 'utf-8', can encode any
     character.
 
-    FIXME: isn't it better to use here urllib.quote instead of duplicating
-    the code? If we use cgi, urllib is already available. if we do
-    duplicate the code from urllib, why we don't use also fast_quote as
-    urllib does?
-
-    FIXME: If we don't use urllib.quote, maybe this is cleaner and faster
-    to use re, in the same way quoteWikinameFS works.
+    TODO: url encoding should use utf-8 - remove the charset option?
     
     @param pagename: the original pagename, maybe containing non-ascii chars
     @rtype: string
-    @return: the quoted filename, all special chars encoded in (xx)
+    @return: the quoted filename, all unsafe characters encoded
     """
-    safe = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789/+-_,\'*'
-    pagename = pagename.replace(u' ', u'_') # " " -> "_"
-    filename = pagename.encode(charset)
-    
-    res = list(filename)
-    c = None
-    for i in range(len(res)):
-        prev = c
-        c = res[i]
-        if c not in safe:
-            # FIXME: why are we doing this?
-            if c == '.' and prev == '/':
-                res[i] = '(%02x)' % ord(c)
-            else:
-                res[i] = '%%%02x' % ord(c)
-    return ''.join(res)
+    pagename = pagename.replace(u' ', u'_')
+    pagename = pagename.encode(charset)
+    return urllib.quote(pagename)
 
 
 def escape(s, quote=0):



