Due: Thursday 11/21 10:00 am
Submission name: work24.txt
Text encoding
- All digital data is represented as binary numbers.
- For text, each character is assigned a number according to some agreed upon convention, called an encoding.
- ASCII was the standard for many years.
- In a plain text file:
- write your first name in lowercase letters
- Write your name is ASCII, put a space between each number
- Convert your ASCII name to hexadecimal, using one 2 digit hexadecimal number for each letter. Put spaces between each number.
- Convert your hexadecimal name to binary, remember that each hex digit turns into 4 binary digits. Your file may look like this:
jonalf 106 111 110 97 108 102 6a 6f 6e 61 6c 66 0110 1001 0110 1111 0110 1110 0110 0001 0110 1100 0110 0110
- If you are using a computer at school, you could try looking at the file in the terminal using
$ hexdump -C work20.txt
Image encoding
- Images are often represented as a grid of color values for pixels, where each pixel is given separate values for Red, Green, and Blue (in that order).
- Here is all the color information for a very small (5x5 pixel) image:
FF 00 00 FF 00 00 FF 00 00 FF 00 00 FF 00 00 00 FF 00 00 FF 00 00 FF 00 00 FF 00 00 FF 00 00 FF 00 00 FF 00 00 FF 00 00 FF 00 00 FF 00 00 FF 00 00 FF 00 00 FF 00 00 FF 00 00 FF 00 FF 00 00 FF 00 00 FF 00 00 FF 00 00 FF 00 00
- Describe what these numbers represent, as well as what the image looks like.
Emojis!
- In order to handle more potential characters that ASCII’s measly 128, we have a new standard, Unicode!
- You can get unicode information for any character here: https://symbl.cc/en/emoji/
- When you click on an emoji, you can see it’s technical information and encoding. For example:
- 😀 https://symbl.cc/en/1F600/
- Name: Grinning Face
- Unicode number: U+1F600
- UTF-8 Value in hex: F0 9F 98 80
- Number of Bytes used to encode: 4B (hint: look at the binary representation, how many bits does it need?).
- Pick a letter in the english alphabet, and provide the following information:
- letter
- Unicode number
- UTF-8 value
- Number of bytes used to encode the letter
- Pick an emoji (keep it clean), and provide the following information:
- emoji name
- Unicode number
- UTF-8 value
- Number of bytes used to encode the emoji
- Here is some further information on unicode, it’s a bit technical, but describes how it works in more detail: https://blog.daftcode.pl/unicode-details-for-developers-300dc6f6e11e.