Storing letters using Binary (Ascii)
Computers store every bit of data as binary. To store a number they simply convert it to its binary equivalent. But how do they store letters, and words?
It's pretty much the same - the computer converts the letter to a number equivalent then stores the number .If you are thinking then how does the computer know that its a number not a letter, short answer - it doesn't. Longer answer, it also stores Meta data that tells it how to layout the data it has stored, which helps it get the right format.
So which number do they use for each letter? They were sensible when they created this and made a = 1, b = 2, c= 3, z = 26
Lower case and Upper case
If a = 1, what is A? it is also 1, just with a different start.
We use 8 bit binary, that means 8 numerals (1's and 0's). When working with letters we use the first 3 to show if it is a lower case, upper case or punctuation / symbol, then the last 5 to show which number:
011 = lower case letter
010 = upper case letter
001 = punctuation ( not all punctuation has a 001 code)
For example, we know that a / A should be a 1 (DEN) - so to show that in binary:
a = 011 00001
A = 010 00001
It is worth noting that the space key ," ", is 001 00000 (it comes up on the exam from time to time when you need to convert two words from binary to letters)
Limits of ASCII
Ascii only uses 8bits (8 numerals) , and 3 of those bits indicates capital or lower case, this creates some limits:
- It only handles English letters
- It has a limited range of symbols
To get around these limits Unicode was created. This uses more bits and as a result can handle far more combinations which allows more languages and symbols to be stored.
Of course, more bits means each letter takes up more storage space than Ascii and that's the trade off. If you want smallest possible storage and don't need the extra characters then use Ascii, if you do then use Unicode.