Text encoding
A really important thing that computers need to do is to be able to represent text. Basically every program will use text, or strings, in some way.
But the only thing that computers really understand is binary. So how do we represent text as these binary numbers?
Encoding
Encoding is essentially when we take our human-readable text, and convert it into a format that computers can more easily understand.
When it comes to text encoding, we’re converting the human-readable letters, numbers and symbols into a binary number that the computer can understand.
For example, the letter “A” might be represented as the binary number 01000001,
or 65, in a particular encoding scheme.
Encoding schemes
Because the ‘A’ will now just be stored as some random number, we need to have a way of getting back to the letter ‘A’ from just reading the binary. That’s where encoding schemes come in!
There are (a few) standards which say ‘this character should be represented by
this number’. So if we see the number 65, we can look it up in the encoding
scheme and find out that it corresponds to the letter ‘A’.
Character code
I might refer to a ‘character code’ in future chapters. A character code just means a number which represents a particular character, in the specific encoding scheme we’re using.
I may say ’The ascii character code for ‘A’ is 65’, which just means that in the ascii encoding scheme, the letter ‘A’ is represented by the number 65.
flashcards
| Question | Answer |
|---|---|
| Define “text encoding” in computing. | Encoding is converting human-readable text (letters, numbers, and symbols) into a binary number that a computer can understand. |
| What does the binary number 01000001 represent in a text encoding scheme? | It might represent the letter “A”, as 01000001 equals the decimal value 65. |
| What is an encoding scheme? | A standard which defines that “this character should be represented by this number,” allowing binary numbers to be looked up and converted back to characters. |
| What is a ‘character code’? | A number which represents a particular character within a specific encoding scheme. |
| What does it mean to say “The ASCII character code for ‘A’ is 65”? | It means that in the ASCII encoding scheme, the letter ‘A’ is represented by the number 65. |