Welcome in this lecture, I'm going to show you how to create a character set program that can print
any code points along the road, we'll be talking about the difference between single and multiplied
code points.
All right.
If you are ready, let's get started.
In the Unicode standard, there are millions of code points for now, I'm going to print only a tiny
part of them, only from A to Z.
Remember, these rune literals are actually numeric Unicode code points.
That is why they get printed as six to five and 90 here.
65 is the code point of a 90 is the code point of that.
OK, now I'm going to print all the characters between the starting and stopping court points, I can
do so because the rules are numeric values, even though they look like characters.
Remember, a character is nothing more than an integer number.
OK, now I'm going to show you how to print runes using different printf verbs.
For example, the Seiver prints a character by the given code point.
It looks like this.
Let me add Heather for the characters table.
OK, it looks better now I'm going to print the cut points as decimal numbers, I can use the diva to
print them as decimals.
Cool, but it doesn't look perfect.
Let me align the verbs a little bit.
Now, it looks better by now.
I think you understand that each character here is actually a court point or a room.
For example, as I said, six to five represents the capital, a character or six to six represents
the capital B character.
And so.
OK, now I'm going to print the court points as hexadecimal numbers here.
I'm going to use the X verb LACHSA.
So that it will print the court point in hexadecimal.
Also, for example, the hexadecimal code point of view is for a.
Lastly, let's print the UTF eight encoded representation of the court points in hexadecimal.
OK, here, by this extra space, print will print the bytes separated by space when you convert a code
point to a string.
Like so go encodes it to UTF eight string value automatically.
So here it will print the encoded bytes of the code point.
So far, so good.
Now let's accept the court point range from the user.
Let me first change the types of these variables to insert here.
I'm going to check whether there are two common line arguments or not.
If so, I'm going to set the starting point to give an argument.
I'm also going to set the stopping point.
This is why I have changed the type of the start and stop variables to insert.
It was because a Twohy function returns int Laslett.
I'm going to check whether there are incorrect cut points.
If so, I'm going to reset them to some defaults like so as you can see, I can assign room literals
to int variables because literals are timeless.
So there's room literals get converted to int values automatically.
Let's first try it with the defaults good, it works now let's print the ASCII character set.
The ASCII standard is a part of Unicode standard and each code point in the ASCII standard is one byte
long.
For example, the space character equals to 32 or the zero character equals to forty eight and so on.
So they can fit into one bytes.
Askey is good and easy to work with, and it can represent the English letters, numbers and some other
fundamental characters using only a single bite.
However, in real life, you may need to work with languages other than English as well.
And they usually use multiple byte code points, for example.
Now I'm going to print the extended lighting called points.
As you can see, each code point is one byte.
However, when they are UTF eight encoded, they become too whites.
So you can store each one of these code points in a single byte, but whenever you want to print them,
you need to bytes.
Remember, a bot can store a number between zero and 255.
For example, this room has a code point that can fit into one byte.
These two hexadecimal digits represent only one byte and they are equal to one hundred and six to one.
However, when this room is UTF eight in code, it it cannot fit into a bottle anymore because UTF eight
encoding for this room requires two bytes anyway.
Now I'm going to print some more code points that require more than one byte.
As you can see this time, each court point is to whites and one UTF eight in caudate, they become
three bites.
So, for example, this rule cannot be stored in a single by black.
So as you can see, there is an error.
It overflows the bite variable.
But you can store it in a room type like so.
The default type of a run literal is run type, so I can do it lachsa.
Anyway, lastly, let's take a look at a few emoji called points, this time each Growthpoint point
is three bytes and one UTF eight encoded they become for whites.
This is the maximum size of a court point for UTF eight.
So using UTF eight, you can represent code points between one and for whites.
So I can store one of these code points in a room variable like so as you can see, it still works.
So in summary, if you want to represent any Unicode code point, you can use the rune type and rune
literals because it can store A'Court Point up to four watts.
All right.
That's all for now.
Please write some of the other blocks here by yourself.
Print them and investigate their code points and encoded bytes and so on.
OK, bye for now.