Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5396f13 commit 7107e8fCopy full SHA for 7107e8f
1 file changed
lib/core/common.py
@@ -1027,10 +1027,19 @@ def safeStringFormat(formatStr, params):
1027
return retVal
1028
1029
def sanitizeAsciiString(subject):
1030
- retVal = None
1031
if subject:
1032
- retVal = "".join(char if ord(char) < 128 else '?' for char in subject)
1033
- return retVal
+ index = None
+ for i in xrange(len(subject)):
+ if ord(subject[i]) >= 128:
1034
+ index = i
1035
+ break
1036
+ if not index:
1037
+ return subject
1038
+ else:
1039
+ retVal = subject[:index] + "".join(subject[i] if ord(subject[i]) < 128 else '?' for i in xrange(index, len(subject)))
1040
+ return retVal
1041
1042
+ return None
1043
1044
def decloakToNamedTemporaryFile(filepath, name=None):
1045
retVal = NamedTemporaryFile()
0 commit comments