From decab6642d631f0594080f8e75c2d07d431bca61 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sun, 10 Apr 2011 16:46:33 +0000 Subject: [PATCH] fix for that @chunk bug --- lib/core/convert.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/core/convert.py b/lib/core/convert.py index a76041935..fad05998b 100644 --- a/lib/core/convert.py +++ b/lib/core/convert.py @@ -14,6 +14,7 @@ except: import sha import pickle +import re import sys import string import struct @@ -97,6 +98,11 @@ def urlencode(value, safe="%&=", convall=False, limit=False): if convall or safe is None: safe = "" + # corner case when character % really needs to be + # encoded (when not representing url encoded char) + if all(map(lambda x: '%' in x, [safe, value])): + value = re.sub("%(?![0-9a-fA-F]{2})", "%25", value, re.DOTALL | re.IGNORECASE) + while True: result = urllib.quote(utf8encode(value), safe)