Binary - Hexadecimal, ASCII, UNICODE

Binary is how a computer interprets code, every computer uses binary and everything you see has come from a binary input to then be translated into images on a screen. You may have seen these two values represented as 0 and 1, but on a computer, they are represented by anything that can be in two states. For example, in memory a low or high voltage is used to store each 0 or 1. On a magnetic disk it's stored with magnetism (whether a tiny spot on the disk is magnetised north or south). One there are multiple ways of representing letters and numbers in binary like Unicode, hexadecimal and ASCII (these three are explained further in.)2’s complement is one way of representing negative numbers in binary. Finding the 2’s complement is a two-stage process, first find the 1’s complement, the second, add 1 to the 1’s complement.

With 1’s complement all your doing is inverting the binary so 1’s become 0’s and 0’s become 1’s and to turn it into 2’s complement your adding 1 to the binary so if the first umber is a 0 it becomes a 1 but if it’s a 1 already then it becomes a 0 and it carries over to the next number in sequence so it its 0101 in 1’s complement and we add the 1 it becomes 0110 as the 1 has to carry over and if the next number so if its 0111 in 1’s complement and then we add 1 it becomes 1000 as the one has to carry over to the next available 0 turning all the previous 1’s to 0’s.

ASCII is a way of coding/ reading in binary using 7 bits with the first 3 being used to show if it was a lower-case letter, upper case letter, numbers and special characters such as:@ ! $ # * % and the other 7 numbers show which letter, number or symbol it is. The first bit is always 0 and the following 7 0’s or 1’s show what letter or number or symbol it is.

As far as ASCII gets you, it’s simply not good enough for an ever-expanding World Wide Web where there are multiple languages and numerous different symbols including emoji’s, a new system was needed, and that was Unicode. There are three schemes to Unicode, UTF-32, UTf-16 and UTF-8. Unicode still uses ASCII at its base for the English language but it improves upon it to accommodate even more letters, numbers and symbols to support over 50 different languages.

UTF-32 uses four bytes, so 32 bits=33,554,432 characters

UTF-16 uses two or four bytes, so 16 or 32 bits=65,536 or 33,554,432 characters

UTF-8 uses one, two, three or four bytes, so 8,16,24,32 bits=256, or 65,536 or 33,554,432 or 4,294,967,296 characters With this new system, you could have multiple languages under the same coding system incorporating over 1 million different characters ranging from English characters e.g. S, C, U to Ȧ, Ω, Ӝ and even ✔, ⭓, ♞ Unicode uses an extremely simple but efficient and easy to explain system much so that it could be described/shown on the back of a napkin.

First you must know the difference between fixed and flexible with UTF, fixed is where its fixed to an exact number of bytes e.g. UTF-32 which can only use four bytes, and flexible is where it can utilize less bytes to consume less space, e.g. UTF-16 which uses two or four bytes and UTF-8 which uses one, two, three or four bytes. UTF-32 is fixed to use 4 bytes and only four bytes, so if it’s a letter for the English dictionary The best example to use for Unicode is UTF-8, it best shows how the encoding works for UTF

Hexadecimal another way of coding / reading binary language, hexadecimal is commonly used for colour selection via hex code with the most common being three-byte hexadecimal number, meaning they have six digits. Hex code uses the 6 digits to respond to the three major colour groups, red, green and blue which are used to create other colours by crossing their hex number. It is broken down into 3 parts the hex code, each part being 2 digits relating back to the red, green and blue:

bit map
hex 6 digit colour code

Hex code byte values range from 00, which is the lowest intensity of a colour, to FF which represents the highest intensity. The colour white, for example, is made by mixing each of the three primary colours at their full intensity, resulting in the Hex colour code of #FFFFFF. Black, the absence of any colour on a screen display, is the complete opposite, with each colour displayed at their lowest possible intensity and a Hex colour code of #000000.

To the right is a table showing the most commonly used colours and their corresponding Hex colour code (you can ignore the RGB colour code), it shows how some of the most common colours are labelled as in Hex, don’t worry if you don’t understand why they have these corresponding codes. The three primary colours, red, green and blue, are made by mixing the highest intensity of the desired colour with the lowest intensities of the other two, red: #FF0000, green: #00FF00 and blue: #0000FF.