CS02-04 Computer Science Watch
Unicode
In this lesson
In this video you'll learn about unicode for GCSE Computer Science. Watch first: {{video:CS02-02}}
By the end: Describe the purpose of Unicode and its advantages over ASCII, state the cost of those advantages, and state that Unicode uses the same codes as ASCII up to 127.
What it covers
- The PURPOSE of Unicode: one code for every character in every language, plus symbols and emoji
- The advantages over ASCII, in the specification's own terms - representing different alphabets and special symbols, allowing a far greater range of characters
- THE COST, which OCR examines: more bits per character means more memory or storage for the same text
- That Unicode uses the SAME codes as ASCII up to 127, so ASCII is a subset of it
- The consequence: for a character like A the ASCII answer and the Unicode answer are the same number, so read which one the question asked for
- That Unicode is a bigger set, not a different arrangement - the ordering ideas from CS02-03 still hold
Key words
About this video
Unicode and ASCII Character Sets | GCSE Computer Science
What Unicode is, why it has more characters than ASCII, its advantages and cost, and how codes 0 to 127 match ASCII.
AQA 8525 and OCR J277 GCSE. Units and file sizes 4 of 6.
Full Units and file sizes playlist: https://www.youtube.com/playlist?list=PLO0-7kcru9G8
More at https://scholafly.com
Watch first: Character Sets and ASCII (Character Encoding) - https://youtu.be/zD9_Zs-lSWE
Video code: CS02-04 (search "ScholaFly CS02-04")
Videos in this chapter:
CS02-00 Units, characters and file size - Intro: https://youtu.be/09-qBlPgybs
CS02-01 Bits, bytes and the units of storage: https://youtu.be/6NVNIeA80bU
CS02-02 Character sets and ASCII: https://youtu.be/zD9_Zs-lSWE
CS02-03 Character codes run in order: https://youtu.be/Oz94XpnG-qA
CS02-04 Unicode: https://youtu.be/8UPCwLqs3PI
CS02-05 Working out the size of a text file: https://youtu.be/3QQuoX_vSSQ
CS02-06 The limits of a fixed number of bits: https://youtu.be/acUh8FmOLcw
#GCSEComputerScience #UnitsAndFileSizes #Unicode
For teachers
This GCSE Computer Science lesson teaches Unicode. By the end, students should be able to describe the purpose of Unicode and its advantages over ASCII, state the cost of those advantages, and state that Unicode uses the same codes as ASCII up to 127. It works through three worked examples and the mistakes examiners report, and suits Foundation and Higher tier students.
Exam board specification references:
AQA GCSE Computer Science (8525)
- 3.3.5 Character encoding
Cambridge OCR Level 1/Level 2 GCSE (9-1) in Computer Science
- 1.2.4 Data storage - Numbers
Read the transcript
Picture all the writing in the world at once: Arabic, Chinese, Hindi, Greek, and the emoji on top of them. ASCII had room for one hundred and twenty-eight characters in total. It spent over thirty of them on instructions, like ring the bell, or move the paper up a line. Something had to give, and a far bigger set replaced it. Yet every one of those one hundred and twenty-eight codes, the bell included, is still in use today, untouched, inside the replacement.
This is video four of six in Units, characters and file size. Everything here stands on the idea of a character set, so if that feels shaky, Character sets and ASCII is the one to go back to.
Start with why ASCII ran out of room. Seven bits make one hundred and twenty-eight different patterns, so ASCII can never hold more than one hundred and twenty-eight characters. That covers English letters, digits and punctuation. There is no space left for Arabic, for Chinese, for Greek, or for a single emoji. A character set is the list of characters a computer can represent, each with its own unique code. Unicode is a character set that gives every character in every writing system its own code, along with symbols and emoji. One word on exam boards. Unicode is examined on two of the three main boards; if yours is the third, treat this video as background. Your board's row is in the table. That is its purpose. Greek typed on one machine arrives as the same Greek on any other, because both machines use the same codes. Each character's number in Unicode has a name, its code point. A code point is the same idea as an ASCII code: one number standing for one character. To make room, Unicode uses more bits for each character than ASCII does. Every extra bit doubles the number of patterns, so the room grows fast. A Unicode encoding that uses two bytes for every character, sixteen bits, already has sixty-five thousand five hundred and thirty-six codes to give out. Unicode comes in more than one version, with different widths, and the versions themselves are not part of the course. Where a width is needed, two bytes per character does the job. So picture ASCII as a small box, drawn inside a much larger box that is Unicode. Unicode holds every character ASCII has, and a great many more besides. Now, why can ASCII never hold Chinese, however its codes are rearranged? Because seven bits only ever make one hundred and twenty-eight patterns, and written Chinese needs thousands. Shuffling codes never adds a new one; extra bits do. One examiner's report, on a question comparing Unicode with ASCII, records this: Candidates were often able to identify that there were more characters in Unicode than ASCII. The same report also says this: Some candidates inaccurately gave the reverse, thinking that Unicode had fewer bits and therefore less characters than ASCII. Both are true of one question. Plenty of answers had the comparison the right way round, and some turned both halves over, giving Unicode fewer bits and fewer characters. If the bigger set is already yours, you are ahead of that reverse. The fix for it is the picture: ASCII is the small box inside, and a box inside another can never be the bigger of the two.
Now the old codes that survived. Inside Unicode, code points nought to one hundred and twenty-seven are ASCII's own codes, character for character. Capital A is sixty-five in ASCII, and sixty-five in Unicode. The bell from the old instructions is seven in both. That was a deliberate choice. Every character ASCII already had kept its old number, so text written in ASCII codes means the same thing when it is read as Unicode. This is why ASCII is called a subset of Unicode. A subset is a set whose members all belong to a bigger set as well. And because the old codes kept their places, the runs from the video Character codes run in order still hold. Capital B is still one more than capital A. Here are four characters to sort: a heart emoji, capital A, the Greek letter alpha, and the digit seven. Which of those four are only in Unicode, and which are in ASCII as well? The heart and alpha are only in Unicode. Capital A and the digit seven are in both, with the same codes, sixty-five and fifty-five. No character at all could go in a third group, only in ASCII, because every ASCII character sits inside Unicode as well. Next, a question in the shape an exam uses, with one box for each set to fill. The ASCII code for T is eighty-four. What is its Unicode code point? Eighty-four. T sits inside the shared range, nought to one hundred and twenty-seven, so the number does not change. So the right answer writes eighty-four twice, once in each box. It can feel like a trick question, and it is the subset doing its job. One examiner's report, on a question that asked for both values, puts it like this: Many students showed their understanding that the ASCII value of characters is a sub-set of Unicode, but a substantial number gave the correct ASCII value but not the Unicode value. So plenty of students knew about the subset, and still gave one number where the question wanted two. The fix is to read which value each box asks for, and fill both. Inside the shared range, the two numbers match.
Next, the other half of the comparison, because all those extra characters come at a price. Unicode spends more bits on every character it stores, even on a plain English letter that ASCII could have held. Picture two files holding the same short paragraph of plain English. One stores it in ASCII. The other uses a Unicode encoding with two bytes per character. With no sums at all, which file is bigger, and why? The Unicode one is larger. Each letter takes at least twice the space there, though not one letter needed the extra room. That is one fact seen twice. More bits give more characters, and more bits give bigger files. How much bigger, in actual bytes, is the job of the video Working out the size of a text file. The report that found the bigger set well known goes on: Some candidates were also able to identify a drawback as it requires more memory or storage for the final file. Some, then, and not most. The advantage was the common answer, and the drawback was the rarer one. The habit is to give them as a pair, in one breath: the extra characters, and the extra memory to store them. Try one: why might a messaging app use Unicode, and what does that choice cost? Its users can write in any language, and send emoji. The price is bigger messages, since each character needs extra bits.
Four quick questions to pull this together, and the last one goes back to the bell. First, what is the purpose of Unicode, in one sentence? Unicode exists to give every character in every writing system, plus symbols and emoji, its own unique code. Next: lower-case z is one hundred and twenty-two in ASCII. What is it in Unicode? One hundred and twenty-two. The letter z is inside the shared range, so the number stays put. Now, what is one advantage of Unicode over ASCII, and what does it cost? Far more characters, from every language plus emoji. The cost is more bits per character, so more memory or storage for the same text. One more: a character has the code point one thousand. Could ASCII store it? No. ASCII stops at one hundred and twenty-seven, so one thousand sits outside the small box, while the bell, at seven, has been inside it all along.
If you could explain to someone, with no notes, why T is eighty-four in both sets and what Unicode costs, then that one's in the bag. Give it a thumbs up, and it drops off your list. If it is not there yet, save it and come back with three questions on it, because by the third it starts to feel normal. Working out the size of a text file comes next, and it puts numbers on that cost.
Next in this chapter is Working out the size of a text file, where that cost gets an actual number.
For more, visit scholafly.com, or watch the next video.
Related terms
For: AQA GCSE 8525, OCR GCSE J277
On the specification
For teachers
This GCSE Computer Science lesson teaches Unicode. By the end, students should be able to describe the purpose of Unicode and its advantages over ASCII, state the cost of those advantages, and state that Unicode uses the same codes as ASCII up to 127. It works through three worked examples and the mistakes examiners report, and suits Foundation and Higher tier students.