Preventing double safe char encoding

This commit is contained in:
Miroslav Stampar 2012-12-20 12:21:45 +01:00
parent 190e317992
commit 728e061c53

View File

@ -42,7 +42,7 @@ def safecharencode(value):
if isinstance(value, basestring):
if any(_ not in SAFE_CHARS for _ in value):
retVal = retVal.replace('\\', SLASH_MARKER)
retVal = re.sub(r'(?i)(?!\\x[0-9A-F]{2})\\', SLASH_MARKER, value)
for char in SAFE_ENCODE_SLASH_REPLACEMENTS:
retVal = retVal.replace(char, repr(char).strip('\''))