1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Allow isprintable() util function to work with unicode

Fixes #6842
This commit is contained in:
James Cammarata 2014-04-03 15:26:02 -05:00
parent 1c9950678a
commit ee0a0b492b

View file

@ -1,9 +1,12 @@
def isprintable(instring):
#http://stackoverflow.com/a/3637294
import string
printset = set(string.printable)
isprintable = set(instring).issubset(printset)
return isprintable
if isinstance(instring, str):
#http://stackoverflow.com/a/3637294
import string
printset = set(string.printable)
isprintable = set(instring).issubset(printset)
return isprintable
else:
return True
def count_newlines_from_end(str):
i = len(str)