Find out how to produce symbols in HTML using the ASCII Table by following the simple information on this page.Demystifying the ASCII Table is what we are all about. Nothing but plain talking here at Webmaster Alpha. Many sites leave out the non-printable codes but we present the ASCII Table in all its glory.
ASCII Control Characters
ASCII characters between decimal and decimal 31 are control characters. these hark back to the days of mainframes and dumb terminals and were the method used to control the display on the terminal, control a print head on a printer, and to transmit information down a primitive serial line. The only characters we use much nowadays from this set are ASCII 009 (tab)
,010 (line feed) ,013(Carriage return) and 027 (Escape). It is good to know these ascii characters are here though because if we are writing a custom encryption scheme, or some sort of custom data transmission system these can come in handy.
The following table presents the ASCII control codes in decimal, octal (base 8) and Hexadecimal (base16):
NUL SOH STX ETX EOT ENQ ACK BEL BS TAB
LF VT FF CR SO SI DLE DC1 DC2 DC3
DC4 NAK SYN ETB CAN EM SUB ESC FS GS
RS US
null start of header start of text end of text end of transmission
enquiry acknowledge bell backspace horizontal tab line feed vertical tab
form feed carriage return shift out shift in data link escape
device control 1 device control 2 device control 3 device control 4
negative acknowledge synchronous idle end of transmission block
cancel end of medium substitute
ecape file seperator group seperator record seperator unit seperator
ASCII Printable Characters
ASCII characters above decimal 31 are often known as printable characters. This is because these codes each correspond to a printed text or punctuation character.
The following table presents the ASCII codes for printable characters in decimal, octal (base 8) and Hexadecimal (base16):
Space ! " # $ % & ' ( )
* + , - . / 0 1 2 3
4 5 6 7 8 9 : ; < =
> ? @ A B C D E F G
H I J K L M N O P Q
R S T U V W X Y Z [
\ ] ^ _ (underscore) `(apostrophe) a b c d e
f g h i j k l m n o
p q r s t u v w x y
z { | } ~
Uses for ASCII Codes
There are many uses for ascii codes on the net. Here are the most common ones:
Html encoding: many characters have a reserved usage in HTML and cannot be directly represented when typed in (eg < > and many others ) if you know the ASCII code number then you can type in &#[code number]; and get for example () do not forget the semi-colon after the ASCII code.
Random Characters: in PHP for example constructing a random string by using the
code $string=chr(rand(65,90)).chr(rand(48,57)).chr(rand(97,122)) will produce a random string containing one upper case letter, one number, and one lower case letter such as A6y
Constructing Unique File/variable Names: in PHP you can use the time() function to get the unix timestamp (number of seconds since 00:00:00 UTC on January 1, 1970) however if your website has many visitors then the chances are that more than one visitor will need a temporary file inside the same second. To get around this you can place a random ASCII string as above in front of the unix time , the odds of this random string being the same are one in 6760
adding another letter makes the odds one in 175760. The dash seperator allows you to use explode() to seperate the timestamp from the characters and delete any files that are older than a certain threshold. This example ASCII filename has just been automatically created:
V3bT-1283536675.tmp
Hopefully this will give tou a glimpse into the world of ASCII characters!