CharCode

A Character Code converter and lister. Outputs a table of Binary, Octal, Decimal, Hexadecimal and ASCII representing the input. Input can be a string of characters or numbers in one of the supported bases. Non printable characters are treated as spaces.

Sample Output:
# Standard output.
% ./charcode Handy Script!
Binary   Oct Dec Hex ASCII
01001000 110 072  48    H
01100001 141 097  61    a
01101110 156 110  6E    n
01100100 144 100  64    d
01111001 171 121  79    y
00100000 040 032  20
01010011 123 083  53    S
01100011 143 099  63    c
01110010 162 114  72    r
01101001 151 105  69    i
01110000 160 112  70    p
01110100 164 116  74    t
00100001 041 033  21    !

# Output one Hex number per character.
% ./charcode -X Handy Script!
0x48 0x61 0x6E 0x64 0x79 0x20 0x53 0x63 0x72 0x69 0x70 0x74 0x21

# Output as binary numbers, one per line.
% ./charcode -B -l Handy Script!
0y01001000
0y01100001
0y01101110
0y01100100
0y01111001
0y00100000
0y01010011
0y01100011
0y01110010
0y01101001
0y01110000
0y01110100
0y00100001

# Convert Hex to ASCII.
% ./charcode -x -A 0x5468697320697320656173792E
This is easy.

If you find any problems or have any suggestions please feel free to email me at LoranceStinson+charcode AT gmail DOT com.

It is available as Gziped tar.
Last updated 2007-08-16.

Changes:

  • 2007-08-16:
    • Fixed a bug with decimal numbers not being processed.
    • Added a testing script.

Back

Created with VIM. Valid HTML 4.01 Transitional.