From: Fredrik Tolf Date: Wed, 18 Sep 2013 04:38:14 +0000 (+0200) Subject: Fixed up URL quoting a bit. X-Git-Url: http://dolda2000.com/gitweb/?p=wrw.git;a=commitdiff_plain;h=cbb90a8de3bed03b68b6e537433c6e6d17ff52cb Fixed up URL quoting a bit. --- diff --git a/wrw/proto.py b/wrw/proto.py index 8c8dcee..1af091f 100644 --- a/wrw/proto.py +++ b/wrw/proto.py @@ -102,10 +102,12 @@ def simpleerror(env, startreq, code, title, msg): return [buf] def urlq(url): + if isinstance(url, unicode): + url = url.encode("utf-8") ret = "" invalid = "&=#?/\"'" for c in url: - if c in invalid or (ord(c) <= 32): + if c in invalid or (ord(c) <= 32) or (ord(c) >= 128): ret += "%%%02X" % ord(c) else: ret += c