Convert octal constants for Python compatibility

This commit is contained in:
Andrew D. Wong 2014-01-29 02:20:07 -05:00
parent 0095241a6f
commit e5f636af2f

View File

@ -17,7 +17,7 @@ def vim_encode(data):
elif isinstance(data, str): elif isinstance(data, str):
str_list = [] str_list = []
for c in data: for c in data:
if (000 <= ord(c) and ord(c) <= 037) or c == '"' or c == "\\": if (0 <= ord(c) and ord(c) <= 31) or c == '"' or c == "\\":
str_list.append("\\%03o" % ord(c)) str_list.append("\\%03o" % ord(c))
else: else:
str_list.append(c) str_list.append(c)