Working with text ASCII and UNICODE. 0 1 1 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0.

15
Working with text ASCII and UNICODE

Transcript of Working with text ASCII and UNICODE. 0 1 1 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 1 1 0 0 0 0.

Page 1: Working with text ASCII and UNICODE.  0 1 1 0 0 0 0 1  0 1 0 0 0 0 0 1  0 0 1 1 0 0 0 0.

Working with textASCII and UNICODE

Page 2: Working with text ASCII and UNICODE.  0 1 1 0 0 0 0 1  0 1 0 0 0 0 0 1  0 0 1 1 0 0 0 0.

0 1 1 0 0 0 0 1

0 1 0 0 0 0 0 1

0 0 1 1 0 0 0 0

Page 3: Working with text ASCII and UNICODE.  0 1 1 0 0 0 0 1  0 1 0 0 0 0 0 1  0 0 1 1 0 0 0 0.

From the CAS curriculumKEY STAGE 3

Representations of:

Unsigned integers

Text. [Key point: each character is represented by a bit pattern. Meaning is by convention only. Examples: Morse code, ASCII.]

Sounds [both involving analogue to digital conversion, e.g. WAV, and free of such conversion, e.g. MIDI]

Pictures [e.g. bitmap] and video.

Many different things may share the same representation, or “the meaning of a bit pattern is in the eye of the beholder” *e.g. the same bits could be interpreted as a BMP file or a spreadsheet file; an 8-bit value could be interpreted as a character or as a number].

Page 4: Working with text ASCII and UNICODE.  0 1 1 0 0 0 0 1  0 1 0 0 0 0 0 1  0 0 1 1 0 0 0 0.

Today’s session

5:00 – 6:00 Computers and text

6.00 – 7.00 Programming in Scratch

Page 5: Working with text ASCII and UNICODE.  0 1 1 0 0 0 0 1  0 1 0 0 0 0 0 1  0 0 1 1 0 0 0 0.

Encoding and decodingSee Boston University CS101 presentation – go to first lecture (whole series is good!)

An excellent introduction to Computer Science and what a bit pattern might mean

Page 6: Working with text ASCII and UNICODE.  0 1 1 0 0 0 0 1  0 1 0 0 0 0 0 1  0 0 1 1 0 0 0 0.

1010001100000011010000000111011110110010100111110 0111011110110000000100100011011101010110010111010 0000101001100000010010111010110100100100111110010 1111000111110000000100001100011101100011001100110 0011101101101011101101100011000011101001100010110 10100111100001000110101000100101111110100101000011101001000011010011111010111010001110010011000010 100100011000110110100100001101000100001010000010101010111000000101100100011001001011001000100011111100000110111010111001101110110011001111110011101110101000101010101100111110111110000001000110011111100100001111000110001101111001011110010100001101 10011111011010001100110110110011101010001111001010001001010110111101011000101011110100010101011011010011100011110110100110110101001010100111011100000011100101011001001001001100111100111011111110010010110100111010011011011010010101011010111010011011011000010101000001001101010011110011101110011101111001010111100111100110011010101100000010010110 00110001010100111011000000010100001100101010100110001011011011111001100100001001101110011000011010 01011101010001001010101101101010010101110101100001110111100101011000111000000001011000001110110111010100001111100111000001011100000100101110011111111011111110001110111100000000101000011110100101001001111010101100001001000111011011100010000010010 0111011000101000111000000001111011011111101110101 0100011001000000100000010000100100000011111001101 1010101110101101000110000101001010110110

Text?

Page 7: Working with text ASCII and UNICODE.  0 1 1 0 0 0 0 1  0 1 0 0 0 0 0 1  0 0 1 1 0 0 0 0.

1010001100000011010000000111011110110010100111110 0111011110110000000100100011011101010110010111010 0000101001100000010010111010110100100100111110010 1111000111110000000100001100011101100011001100110 0011101101101011101101100011000011101001100010110 10100111100001000110101000100101111110100101000011101001000011010011111010111010001110010011000010 100100011000110110100100001101000100001010000010101010111000000101100100011001001011001000100011111100000110111010111001101110110011001111110011101110101000101010101100111110111110000001000110011111100100001111000110001101111001011110010100001101 10011111011010001100110110110011101010001111001010001001010110111101011000101011110100010101011011010011100011110110100110110101001010100111011100000011100101011001001001001100111100111011111110010010110100111010011011011010010101011010111010011011011000010101000001001101010011110011101110011101111001010111100111100110011010101100000010010110 00110001010100111011000000010100001100101010100110001011011011111001100100001001101110011000011010 01011101010001001010101101101010010101110101100001110111100101011000111000000001011000001110110111010100001111100111000001011100000100101110011111111011111110001110111100000000101000011110100101001001111010101100001001000111011011100010000010010 0111011000101000111000000001111011011111101110101 0100011001000000100000010000100100000011111001101 1010101110101101000110000101001010110110

Sound?

Page 8: Working with text ASCII and UNICODE.  0 1 1 0 0 0 0 1  0 1 0 0 0 0 0 1  0 0 1 1 0 0 0 0.

1010001100000011010000000111011110110010100111110 0111011110110000000100100011011101010110010111010 0000101001100000010010111010110100100100111110010 1111000111110000000100001100011101100011001100110 0011101101101011101101100011000011101001100010110 10100111100001000110101000100101111110100101000011101001000011010011111010111010001110010011000010 100100011000110110100100001101000100001010000010101010111000000101100100011001001011001000100011111100000110111010111001101110110011001111110011101110101000101010101100111110111110000001000110011111100100001111000110001101111001011110010100001101 10011111011010001100110110110011101010001111001010001001010110111101011000101011110100010101011011010011100011110110100110110101001010100111011100000011100101011001001001001100111100111011111110010010110100111010011011011010010101011010111010011011011000010101000001001101010011110011101110011101111001010111100111100110011010101100000010010110 00110001010100111011000000010100001100101010100110001011011011111001100100001001101110011000011010 01011101010001001010101101101010010101110101100001110111100101011000111000000001011000001110110111010100001111100111000001011100000100101110011111111011111110001110111100000000101000011110100101001001111010101100001001000111011011100010000010010 0111011000101000111000000001111011011111101110101 0100011001000000100000010000100100000011111001101 1010101110101101000110000101001010110110

Image?

Page 9: Working with text ASCII and UNICODE.  0 1 1 0 0 0 0 1  0 1 0 0 0 0 0 1  0 0 1 1 0 0 0 0.

Text Data

Are sets of characters

Characters could be letters, digits, symbols (£, &),

Telephone numbers are text data (should be encoded as text)

Page 11: Working with text ASCII and UNICODE.  0 1 1 0 0 0 0 1  0 1 0 0 0 0 0 1  0 0 1 1 0 0 0 0.

ASCII code – another coding system for text. Used by computers

space 0100000 0 0110000 A 1000001 a 1100001

! 0100001 1 0110001 B 1000010 b 1100010

" 0100010 2 0110010 C 1000011 c 1100011

£ 0100011 3 0110011 D 1000100 d 1100100

$ 0100100 4 0110100 E 1000101 e 1100101

% 0100101 5 0110101 F 1000110 f 1100110

& 0100110 6 0110110 G 1000111 g 1100111

' 0100111 7 0110111 H 1001000 h 1101000

( 0101000 8 0111000 I 1001001 i 1101001

) 0101001 9 0111001 J 1001010 j 1101010

* 0101010 : 0111010 K 1001011 k 1101011

Note how the codes for A .. Z , a .. Z and 0 .. 9 are sequences

Page 12: Working with text ASCII and UNICODE.  0 1 1 0 0 0 0 1  0 1 0 0 0 0 0 1  0 0 1 1 0 0 0 0.

ASCII & UnicodeASCII uses 7 bits to encode characters

Extended ASCII uses 8 bits

Unicode uses 8, 16 or 32 bits and is usually shown in Hex. 16 bits is the most common system used.

Page 13: Working with text ASCII and UNICODE.  0 1 1 0 0 0 0 1  0 1 0 0 0 0 0 1  0 0 1 1 0 0 0 0.

ASCII codes are a subset of Unicode

Unicode uses the

same code for A

Page 14: Working with text ASCII and UNICODE.  0 1 1 0 0 0 0 1  0 1 0 0 0 0 0 1  0 0 1 1 0 0 0 0.

Explore the ASCII codes using the Insert Symbol option in MS Word

What different

alphabets are there?

Note the character code

can’t be represented in

1 byte

Page 15: Working with text ASCII and UNICODE.  0 1 1 0 0 0 0 1  0 1 0 0 0 0 0 1  0 0 1 1 0 0 0 0.

Now try… James Robinson’s Binary Messaging System

Can you create your name in ASCII?

Good for binary practice as well as understanding ASCII coding