diff --git a/reporting/ascii-codes.py b/reporting/ascii-codes.py index e93be67..7f80c81 100755 --- a/reporting/ascii-codes.py +++ b/reporting/ascii-codes.py @@ -1,7 +1,10 @@ #!/usr/bin/env python3 import sys, os -sys.path.append(os.path.dirname(os.path.realpath(__file__))) +sys.path.append(os.path.join( + os.path.dirname(os.path.realpath(__file__)), + "..", "py-packages", "markslider", "markslider" +)) import ansicodes from argparse import ArgumentParser @@ -42,9 +45,14 @@ if __name__ == "__main__": table = [[] for x in range(8)] for c in range(0, 256): col = int(c / 32) - table[col].append( - (c, chr(c)) - ) + try: + table[col].append( + (c, chr(c).encode('latin1').decode(opts.cs)) + ) + except UnicodeDecodeError: + table[col].append( + (c, " ") + ) # sys.stdout.write(chr(c).decode('latin1')) # remove control chars table.pop(0)