Welcome to our deep dive into the world of ASCII and Unicode! Today, we'll explore these fascinating systems that help us communicate with computers. šÆ
ASCII (American Standard Code for Information Interchange) is a character encoding standard used in computing to represent alphabets, numbers, and symbols. It was developed in the 1960s and contains 128 unique characters.
Here's an ASCII table snippet for your reference:
0 1 2 3 4 5 6 7 8 9 A B C D E F
0 NUL SOH STX ETX EOT ENQ ACK BEL BS FS GS RS US SP ! " # $ % & ' ( ) * + , - . /
1 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ DEL
š Note: NUL, SOH, STX, ETX, EOT, ENQ, ACK, BEL, BS, FS, GS, RS, US, and DEL are special characters in ASCII with specific functions.
Unicode is a more extensive character encoding system that supports a vast range of scripts and languages, including ASCII. Unicode can represent more than 130,000 characters from virtually every written language.
Unicode hex code range: U+0000 - U+10FFFF
š Note: The Unicode standard assigns a unique hexadecimal number (Unicode code point) to each character.
In programming, we often use libraries and functions to work with ASCII and Unicode characters.
# Print ASCII characters in Python
for i in range(ord('@'), ord('~')+1):
print(chr(i), end=" ")# Print Unicode characters in Python
for i in range(9728, 12288): # Emoji range in Unicode
print(chr(i), end=" ")š Note: The examples above use the ord() function to get the ASCII value of a character and the chr() function to get the character from its ASCII value.
What is the total number of unique characters in ASCII?
That's it for today! We hope you enjoyed learning about ASCII and Unicode. Stay tuned for more exciting lessons on Data Structures and Algorithms. Happy coding! šš»š