Skip to content
Learnearn.uk » IGCSE Computer Science Course » Text Representation in Binary

Text Representation in Binary

Starter


Starter

Converting Text to Binary(ASCII)

Converting text to binary

When computers were first invented most text was represented in binary using the ASCII (American Standard Code for  Information Interchange).

Converting text to ASCII formatted binary is a simple process. You simply look up the decimal value for the character in the ASCII table below, and then convert that value from decimal to binary, like we did last lesson.

Example – hello

ascii-hello-example

ASCII Table

DO NOT USE THE HEX COLUMN!!!

Click to enlarge

Click to enlarge

ASCII Table

Binary > Text

Converting Binary to Text

Converting from binary to text is nice and simple. You simply convert each binary number to a decimal number and then look up that number on the ASCII table.

ascii-goodbye-example

Practice

Convert these text examples to binary:

a. dog

b. cat

c. mouse

Convert these binary examples to text:

d. 01100101 01100111 01100111

e. 01101000 01100001 01101101

f. 01100011 01101000 01101001 01110000 01110011

Limitations of ASCII

Limitation of ASCII

As computer system usage spread in the US they were mostly used for calculations and storage of data in English. ASCII worked well for this purpose but as computer adoption became more widespread in Europe the limitations of ASCII became clear. ASCII could not representation the accents found in European languages. This lead to the development of Extended ASCII that included letters with accents.

This worked well in European countries but as computers began to gain a hold in countries with non-roman alphabets (such as Chinese / Japanese / Cyrillic) it became clear that 256 Characters was not going to be any where near enough – we were going to need 100,000+ characters for all characters used in different languages.

Because of these limitations new formats were introduced (such as UFT and Unicode). These allowed computers to use millions of different characters, alphabets and special characters (such as emojis, non-roman alphabets and mathematical symbols.

Python Script to display all ASCII / Extended ASCII Codes

Try out this Python Script to display all the ASCII codes on your computers. Some codes might not display properly 🙁

import os
current = 1
os.system('cls') # use 'clear' for linux based systems
print("#### ASCII CHARACTERS ####\n")
while current < 255:
	print(str(current)+'-'+chr(current).strip(),end="\t")
	if current %8 == 0:
		print()
	if current %128 == 0:
		print("\n#### EXTENDED ASCII CHARACTERS ####\n")
	current +=1
	
input()

Resources