DoRevision

Secret Codes

The letter A is 65, and not for any reason to do with the letter A. Once you see that a character set is an agreement rather than a fact, the rest of this topic follows from it.

⏱️ 16 min 🎯 14 activities
Best used for
Homework Independent study Mock preparation

Get the method right under pressure

Free interactive practice on the steps that lose marks under exam pressure.

Start revising free

What you'll cover

Sixty-five is a decision, not a discovery

A computer stores numbers. It does not store letters, and there is nothing about a circuit that could hold one. So text is stored by agreeing which number will stand for which character. In the older of the two agreements you need to know, the letter A is 65. ⚠️ Now ask why it is 65, and notice that there is no answer. Not because A is the first letter. Not because of anything about its shape or its sound. It is 65 because enough people agreed it would be, and it could just as easily have been anything else if they had agreed on that instead. A character set is an agreement, not a fact. That sounds like a small distinction and it is the whole topic. It explains why a second agreement had to be invented, why a file read under the wrong agreement comes out as gibberish, and why the newer agreement kept quite a lot of the older one on purpose. You already know from the data types topic that the character 7 and the number 7 are different things. This is why.

Words for character encoding

Five terms. Notice that the fourth one is described by what it can do rather than by a single number, and that is deliberate.

The old agreement and the new one

Two agreements, and a third column that is easy to skip and is where the interesting part lives.

How to answer a why-was-it-needed question

This shape of question comes up all over this specification: something newer exists, and you are asked why. There is a two-part answer that works every time. Say what the older thing could not do. Its limit is the reason anything replaced it, and a question asking why is really asking for that limit. Then say what fixing it cost. ⚠️ Nothing ever becomes more capable for free, and naming the price is what separates an answer that understands the change from one that has memorised that it happened. ⚠️ What earns nothing at all is naming the newer thing, because the question has already named it for you. "Unicode was introduced because Unicode can handle more characters" is a sentence that has travelled in a circle. A weak answer says a newer thing arrived. A strong answer says what was impossible before, and what had to be given up to make it possible.

Match each fact to what it explains

  • Codes for consecutive letters run consecutively
  • The two agreements give the same codes to the characters they share
  • The older set had room for only 128 codes
  • A larger set needs more bits for each character
  • why sorting a list of words into alphabetical order works at all
  • why documents written decades ago still open correctly today
  • why a second, larger agreement had to be created
  • why the same text takes up more storage in the newer set

Why a second agreement was needed

A character set larger than ASCII had to be created. What was the actual reason?

  • ASCII's 128 codes were enough for English but left no room for the many other writing systems in use
  • ASCII gave its codes in the wrong order, so text could not be sorted properly
  • ASCII used too many bits for each character, so text files were too large
  • ASCII had no way of representing digits or punctuation marks

Why B follows A

In ASCII the letter A is 65. B is 66. C is 67, and the rest of the alphabet carries on in order. ⚠️ That ordering is not decoration, and it is not obvious that it had to be that way. Because the codes run in sequence, a program can compare two letters simply by comparing two numbers - and that is the only reason sorting a list of words into alphabetical order works at all. Scramble the assignments and every alphabetical sort on earth stops working, while every letter remains perfectly storable. Now here is the part that proves a character set really is an agreement rather than a fact. When the larger set was designed, it kept the same codes for the characters it shared with the older one. ⚠️ It did not have to. The designers could have numbered everything from scratch, and there is no natural law that stopped them. But if they had, every document already written would have become nonsense the instant it was opened under the new agreement. So the new agreement deliberately inherited the old one's decisions. That is why text from decades ago still displays correctly today - not because the characters have fixed values, but because somebody chose to keep a promise.

How many codes seven bits give

ASCII uses seven bits for each character. Each bit can be a 0 or a 1. Work out how many different codes seven bits can represent altogether.

What the codes let you do

Select the TWO statements that are true.

  • Because consecutive letters have consecutive codes, text can be sorted by comparing numbers
  • The larger set kept the same codes as the older one for the characters they share
  • A character set is a natural property of the letters rather than an agreement between people
  • The character 7 and the number 7 are stored in exactly the same way

Complete the character encoding paragraph

An agreed list saying which number stands for which symbol is called a _____. The older of the two, designed for English and using seven bits for each character, is _____. The much larger one, created so that the writing systems of the world could be represented, is _____. The particular number standing for one symbol is its _____.

character set ASCII Unicode character code place value nibble parameter index

Codes at speed

Five in a row, three lives. Every one of these follows from a character set being an agreement.

Spot the true character encoding facts

Tap the TWO statements that are true.

  • A character set is an agreement about which number stands for which symbol
  • Consecutive letters have consecutive codes, which is what makes sorting work
  • The letter A is 65 because of a property of the letter itself
  • The larger character set uses fewer bits per character than the older one

Three encoding calls

Three situations. Choose the answer that explains rather than just describes.

  • A text file written many years ago opens perfectly in modern software, with every character correct. What explains that?
  • A page of text written in a non-English alphabet displays as a screenful of meaningless symbols. What has gone wrong?
  • An exam question asks why Unicode was introduced. What does a full-mark answer have to contain?

Explain why one character set was not enough

A friend has learned that A is 65 and that Unicode is bigger, and cannot say anything more than that. Write them the answer that turns two facts into an explanation.

  • Explain what a character set is, and why the code for a letter is a decision rather than a fact about the letter
  • State how many bits ASCII uses for each character, and how many different codes that allows
  • Explain why that was not enough, and what the larger set was created to do
  • Explain what the larger set costs compared with the older one
  • Finish by explaining why text written decades ago still displays correctly today