From 308c78844d366c40f31bfcccb5426a1adf84f3c8 Mon Sep 17 00:00:00 2001 From: William Ballenthin Date: Sat, 25 Jul 2020 00:59:32 -0600 Subject: [PATCH] show-features: fix error when piping features to less --- scripts/show-features.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/show-features.py b/scripts/show-features.py index f7a9bd7e..155ed389 100644 --- a/scripts/show-features.py +++ b/scripts/show-features.py @@ -132,7 +132,11 @@ def main(argv=None): for insn in extractor.get_instructions(f, bb): for feature, va in extractor.extract_insn_features(f, bb, insn): - print("insn: 0x%08x: %s" % (va, feature)) + try: + print("insn: 0x%08x: %s" % (va, feature)) + except UnicodeEncodeError: + # may be an issue while piping to less and encountering non-ascii characters + continue return 0