This commit is contained in:
Kovid Goyal 2011-02-12 00:24:52 -07:00
parent 58abfe6f76
commit 3fd9be15d2

View File

@ -12,6 +12,8 @@ def clean_ascii_chars(txt, charlist=None):
Remove ASCII control chars: 0 to 8 and 11, 12, 14-31 by default Remove ASCII control chars: 0 to 8 and 11, 12, 14-31 by default
This is all control chars except \\t,\\n and \\r This is all control chars except \\t,\\n and \\r
''' '''
if not txt:
return ''
global _ascii_pat global _ascii_pat
if _ascii_pat is None: if _ascii_pat is None:
chars = list(range(8)) + [0x0B, 0x0C] + list(range(0x0E, 0x1F)) chars = list(range(8)) + [0x0B, 0x0C] + list(range(0x0E, 0x1F))