Drawing with CP437
Code Page 437 is the original character set of the IBM PC. These symbols have been included in subsequent UTF, which includes ASCII as a subset. They can be used to draw box and other shapes if required. The sample program below shows one way to use these.
The characters are available as hex values through perl. Using print "\x{2550}" will draw a short double horizontal line (character 2550) from the table below. To see which value to use, add the character x from the column to the character string from the row to the left (replacing the letter x) to get the character you want. These are hexadecimal values.
| x= | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
| 250x | ─ | ━ | │ | ┃ | ┄ | ┅ | ┆ | ┇ | ┈ | ┉ | ┊ | ┋ | ┌ | ┍ | ┎ | ┏ |
| 251x | ┐ | ┑ | ┒ | ┓ | └ | ┕ | ┖ | ┗ | ┘ | ┙ | ┚ | ┛ | ├ | ┝ | ┞ | ┟ |
| 252x | ┠ | ┡ | ┢ | ┣ | ┤ | ┥ | ┦ | ┧ | ┨ | ┩ | ┪ | ┫ | ┬ | ┭ | ┮ | ┯ |
| 253x | ┰ | ┱ | ┲ | ┳ | ┴ | ┵ | ┶ | ┷ | ┸ | ┹ | ┺ | ┻ | ┼ | ┽ | ┾ | ┿ |
| 254x | ╀ | ╁ | ╂ | ╃ | ╄ | ╅ | ╆ | ╇ | ╈ | ╉ | ╊ | ╋ | ╌ | ╍ | ╎ | ╏ |
| 255x | ═ | ║ | ╒ | ╓ | ╔ | ╕ | ╖ | ╗ | ╘ | ╙ | ╚ | ╛ | ╜ | ╝ | ╞ | ╟ |
| 256x | ╠ | ╡ | ╢ | ╣ | ╤ | ╥ | ╦ | ╧ | ╨ | ╩ | ╪ | ╫ | ╬ | ╭ | ╮ | ╯ |
| 257x | ╰ | ╱ | ╲ | ╳ | ╴ | ╵ | ╶ | ╷ | ╸ | ╹ | ╺ | ╻ | ╼ | ╽ | ╾ | ╿ |
| 258x | ▀ | ▁ | ▂ | ▃ | ▄ | ▅ | ▆ | ▇ | █ | ▉ | ▊ | ▋ | ▌ | ▍ | ▎ | ▏ |
| 259x | ▐ | ░ | ▒ | ▓ | ▔ | ▕ | ▖ | ▗ | ▘ | ▙ | ▚ | ▛ | ▜ | ▝ | ▞ | ▟ |
If the table above does not display properly in your browser, the image below (on wikipedia) will show the characters being referred to.
Copy and paste this program to see how to use these characters.
#!/usr/bin/perl
use strict;
# encode output to STDOUT as binary using UTF8
binmode(STDOUT, ":utf8");
print "START DEMO\n\n";
# simple demo of UTF8 chars - formerly CP437 chars - to draw boxes with 'text'
# This demo should draw a box split horizontally in two. Horizontal lines should
# be double lines, vertical lines should be single. The completed shape is a figure 8.
#
my $horiz = "\x{2550}";
my $vert = "\x{2502}";
my $topleft = "\x{2552}";
my $midleft = "\x{255E}";
my $botleft = "\x{2558}";
my $topright = "\x{2555}";
my $midright = "\x{2561}";
my $botright = "\x{255B}";
print "$topleft$horiz$horiz$horiz$topright\n";
print "$vert $vert\n";
print "$midleft$horiz$horiz$horiz$midright\n";
print "$vert $vert\n";
print "$botleft$horiz$horiz$horiz$botright\n";
print "\nEND DEMO\n";
# end of demo
Last updated: 20120108-18:27