Skip to content
Snippets Groups Projects
Commit 3bd73fbc authored by Bartek Wrona's avatar Bartek Wrona
Browse files

Merge branch 'escaping_fix2' into 'develop'

Some characters apparently need long 8-byte encoding

See merge request !117
parents 9ad5fe2f 65138c5c
No related branches found
No related tags found
5 merge requests!456Release candidate v1 24,!230Setup monitoring with pghero,!138Small typos fixed,!135Enable postgres monitoring on CI server,!117Some characters apparently need long 8-byte encoding
...@@ -78,19 +78,23 @@ def escape_characters(text): ...@@ -78,19 +78,23 @@ def escape_characters(text):
if ch in SPECIAL_CHARS: if ch in SPECIAL_CHARS:
dw = SPECIAL_CHARS[ch] dw = SPECIAL_CHARS[ch]
ret = ret + dw ret = ret + dw
elif ch.isprintable():
ret = ret + ch
else: else:
# escaped_value = ch.encode('unicode-escape').decode('utf-8')
ordinal = ord(ch) ordinal = ord(ch)
hexstr = hex(ordinal)[2:] if ordinal <= 0x80 and ch.isprintable():
escaped_value = '\\u' ret = ret + ch
i = len(hexstr) else:
while i < 4: hexstr = hex(ordinal)[2:]
escaped_value += '0' i = len(hexstr)
i += 1 max = 4
escaped_value += hexstr escaped_value = '\\u'
ret = ret + escaped_value if i > max:
max = 8
escaped_value = '\\U'
while i < max:
escaped_value += '0'
i += 1
escaped_value += hexstr
ret = ret + escaped_value
ret = ret + "'" ret = ret + "'"
return ret return ret
......
Subproject commit 4ee51004b4d83d2c12ca8f6e10faab762cc0262f Subproject commit fa660ef0ee019ba9c2da91e7a9140423593d944e
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment