From 5395ad58cc921d643e92dcea9607a1cbc768e3a8 Mon Sep 17 00:00:00 2001 From: Sebastian Gaidzik Date: Mon, 7 Jun 2021 11:00:46 +0200 Subject: [PATCH] Remove Non-ASCII Characters But Leave Line Breaks In Place HEX File --- bincopy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bincopy.py b/bincopy.py index b217e74..5730a3b 100755 --- a/bincopy.py +++ b/bincopy.py @@ -5,7 +5,7 @@ import copy import binascii -import string +import string,re import sys import argparse from collections import namedtuple @@ -841,6 +841,7 @@ def add(self, data, overwrite=False): if is_srec(data): self.add_srec(data, overwrite) elif is_ihex(data): + data = re.sub('[^\x20-\x7E]','',data) self.add_ihex(data, overwrite) elif is_ti_txt(data): self.add_ti_txt(data, overwrite)