From 728e061c5315ac06f4edd4fdccb32162186e378e Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 20 Dec 2012 12:21:45 +0100 Subject: [PATCH] Preventing double safe char encoding --- extra/safe2bin/safe2bin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/safe2bin/safe2bin.py b/extra/safe2bin/safe2bin.py index 9e8256075..c5aa4da16 100755 --- a/extra/safe2bin/safe2bin.py +++ b/extra/safe2bin/safe2bin.py @@ -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('\''))