diff --git a/bin/ascii-codes b/bin/ascii-codes new file mode 120000 index 0000000..221b69d --- /dev/null +++ b/bin/ascii-codes @@ -0,0 +1 @@ +../reporting/ascii-codes.py \ No newline at end of file diff --git a/reporting/ascii-codes.py b/reporting/ascii-codes.py new file mode 100755 index 0000000..ff1f021 --- /dev/null +++ b/reporting/ascii-codes.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +import sys, os +sys.path.append(os.path.dirname(os.path.realpath(__file__))) +import ansi +from argparse import ArgumentParser + +def setup_options(): + parser = ArgumentParser() + parser.add_argument("cs",type=str, default = "cp437", nargs = '?', + choices = ["cp437", "latin1", "cp850"] + ) + opts=parser.parse_args() + return opts + + +if __name__ == "__main__": + opts = setup_options() + table=[[] for x in range(8)] + for c in range(0,256): + col = c/32 + table[col].append((c,chr(c).decode(opts.cs).encode('utf-8','ignore'))) + #sys.stdout.write(chr(c).decode('latin1')) + # remove control chars + table.pop(0) + bc = ansi.code() + bc.clear() + print(bc.color_string("="*20 + " ${Y}%s${Z} "%( opts.cs, ) + "="*20)) + for x,col in enumerate(table): + for y,row in enumerate(col): + bc.posprint( + y + 2, + 1 + x*7, + bc.color_string( + "${c}%03d: ${G}%s${Z}"%( row ) + ) + ) + print('') +