ASCII

ASCII is one specific text encoding scheme.

It was one of the first text encoding schemes that came about.

How many bits?

ASCII can store 128 different characters. That means we need to use 7 bits to store each character, because 2^7 = 128.

ASCII character codes

The ASCII character code for ‘A’ is 65, and the ASCII character code for ‘a’ is 97. If we include numbers, the character ‘0’ has the ASCII character code 48.

From that, you can work out all the other letters, because they are sequential!

The code for ‘B’ is 66, ‘C’ is 67, and so on. The code for ‘b’ is 98, ‘c’ is 99, and again, so on. That’s one of the reasons ASCII is nice to work with!

Benefits of ASCII

Drawbacks of ASCII

flashcards

QuestionAnswer
What is the name of the specific text encoding scheme described?ASCII
How many different characters can ASCII store?128
How many bits are needed to store each ASCII character?7 bits, because 2^7 = 128
What is the ASCII code for the character ‘A’?65
What is the ASCII code for the character ‘a’?97
What is the ASCII code for the character ‘0’ (zero)?48
If ‘B’ has ASCII code 66 and ‘A’ has code 65, how are the letter codes arranged?They are sequential.
What is a benefit of ASCII regarding extracting a substring?With ASCII, you know exactly where the nth character is by adding an offset to the start of the string.
Why can’t you find the nth character of a UTF-8 string by simply adding an offset?Because in UTF-8, not all characters are represented by the same number of bits (unlike ASCII).
What is a major drawback of ASCII concerning languages?It can only represent 128 (or 256 with extended-ASCII) characters, which is not enough for many languages and symbols.
Why can’t we add more characters to ASCII?ASCII doesn’t support adding more characters like Unicode does.