From 4c159f17de0f6e3ee403e0476c56c5106cd8b6de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Sun, 6 May 2018 21:58:47 +0200 Subject: [PATCH] fix: fail on buggy utf-8 --- mail_to_misp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mail_to_misp.py b/mail_to_misp.py index 345a7d3..af77a1b 100755 --- a/mail_to_misp.py +++ b/mail_to_misp.py @@ -353,7 +353,7 @@ if __name__ == '__main__': sys.exit(-1) if args.infile: - pseudofile = BytesIO(args.infile.read().encode()) + pseudofile = BytesIO(args.infile.read().encode('utf8', 'surrogateescape')) elif args.read: # read from tempfile with open(args.read, 'rb') as f: