Binary, ASCII, UTF-8

Objectives

  • Define Bits and Bytes
  • Convert Decimal to Binary and vice versa
  • Describe UTF-8 and ASCII, including the differences between the two

Binary

Looking at Decimal representations of numbers

  • 34
  • 8
  • 705

Looking at Binary

representations of numbers

  • 01001
  • 10010010
  • 101

1

0

At the most basic level,

a bit tells a wire if an electric current is flowing through it or not

1 = on/true/+

0 = off/false/-

1 or 0 = bit

8 bits (  10010010) = byte

1
0
10010010

Bit or Byte?

  • 1
  • 00010001
  • 0
  • 11111111
  • 111

Can I turn 111 into a byte?

Why 8?

Tradition

Converting Binary to Decimal

  • 10
  • 00000111
  • 10101
  • 11110

Converting Decimal to Binary

  • 4
  • 75
  • 457

ASCII

  • 7-bit encoding
  • Each byte represents a character

UTF-8

  • Another type of encoding
  • Superset of ASCII
    • Share the same encoding for first 128 chars
  • Ability to use multiple bytes to represent one char
Made with Slides.com