Ignore encoding errors in filters

Fixes #161
This commit is contained in:
Drew DeVault 2019-06-07 10:18:46 -04:00
parent a974027efe
commit 32a9da3143
2 changed files with 2 additions and 0 deletions

View file

@ -7,6 +7,7 @@ ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
stat_re = re.compile(r'(| \d+ )(\+*)(\-*)')
lines_re = re.compile(r'@@ (-\d+,\d+ \+\d+,\d+) @@')
sys.stdin.reconfigure(encoding='utf-8', errors='ignore')
patch = sys.stdin.read().replace("\r\n", "\n")
patch = ansi_escape.sub('', patch)

View file

@ -11,6 +11,7 @@ ansi_escape = re.compile(r'\x1B\[[0-?]*[ -/]*[@-~]')
quote_prefix_re = re.compile(r"On .*, .* wrote:")
quote_re = re.compile(r">+")
sys.stdin.reconfigure(encoding='utf-8', errors='ignore')
mail = sys.stdin.read().replace("\r\n", "\n")
mail = ansi_escape.sub('', mail)