Chars ASCII v2
Chars ASCII v2
Characters
Character Set
ASCII, Unicode
1
What a computer “sees”
What a computer “sees”
What you should know
Explain the use of binary codes to
represent characters (A, B ..z, 1, ? …)
Explain the term “character set”
ASCII & Unicode
Describe, with examples, the
relationship between:
the number of bits per character and
the number of characters which can be
represented
4
Codes to represent characters is not
new!
5
What is
“SOS” and
what code is
this?
6
Binary Digits - BITs & Bytes
BIT
Binary digIT
0 or 1
ON or OFF
Smallest unit of
memory
Byte
8 BITs
Store one character
Why 8 bits?
7
ASCII
(American Standard Code for Information Interchange)
8
7 bits is just right?
A byte was the number of bits to code for a character
1 bit = 21 = 0, 1 = 2 distinct codes
2 bit = 22 = 00, 01,10, 11 = 4 distinct codes
3 bit = 23 = 8 distinct codes
4 bit = 24 = 16 distinct codes
5 bit = 25 = 32 distinct codes
6 bit = 26 = 64 distinct codes
7 bit = 27 = 128 distinct codes – good!
8 bit = 28 = 256 distinct codes - too many
9
ASCII & Binary
Note the characters
are “sequential”
A, B, C ….
A is less than B
B is less than C …
Useful for sorting!
Try this website:
ASCII text to binary
10
ASCII
Code in
Hex!
• This is the ASCII
• “Character Set”.
• So a “Character
Set” is:
• All the codes &
and their
corresponding
characters
11
Relationship between number of bits & codes
12
But a byte is 8 bits?
Just the right number of bits to code for a character
7 bit = 27 = 128 distinct codes - just right
Sometimes the 8th bit was used as a check
digit
As 8-bit computers became more common
The ASCII was extended to 256 codes
EBCDIC
Extended Binary Coded Decimal Interchange Code
8 bit = 28 = 256 characters
These “extra” codes could represent more
non-English characters and strange
mathematical symbols.
So now a Byte is accepted to be 8 bits.
13
Russian Cyrillic uses 8 bits
28 gives 256 different codes
First 128, same as ASCII 7 bit code ….
14
Unicode – What about other languages &
"strange" letters or symbols?
uses 16 bits
... 216 = 65536
different characters
or even up to 32 bits
or 4 bytes per
character
232 = 4,294,967,296
more than 4 billion
possible codes!!
15
Character map for
Hieroglyphics
16