WEBVTT 00:02.530 --> 00:08.190 Welcome in this lecture, I'm going to show you how to create a character set program that can print 00:08.190 --> 00:14.990 any code points along the road, we'll be talking about the difference between single and multiplied 00:15.000 --> 00:15.810 code points. 00:15.960 --> 00:16.520 All right. 00:16.650 --> 00:18.460 If you are ready, let's get started. 00:19.820 --> 00:25.760 In the Unicode standard, there are millions of code points for now, I'm going to print only a tiny 00:25.760 --> 00:28.200 part of them, only from A to Z. 00:29.060 --> 00:33.510 Remember, these rune literals are actually numeric Unicode code points. 00:34.160 --> 00:38.080 That is why they get printed as six to five and 90 here. 00:38.690 --> 00:43.220 65 is the code point of a 90 is the code point of that. 00:44.390 --> 00:50.330 OK, now I'm going to print all the characters between the starting and stopping court points, I can 00:50.330 --> 00:55.190 do so because the rules are numeric values, even though they look like characters. 00:55.830 --> 00:59.450 Remember, a character is nothing more than an integer number. 01:00.440 --> 01:04.880 OK, now I'm going to show you how to print runes using different printf verbs. 01:05.660 --> 01:09.860 For example, the Seiver prints a character by the given code point. 01:10.520 --> 01:11.720 It looks like this. 01:13.550 --> 01:16.190 Let me add Heather for the characters table. 01:23.490 --> 01:30.990 OK, it looks better now I'm going to print the cut points as decimal numbers, I can use the diva to 01:30.990 --> 01:32.370 print them as decimals. 01:33.120 --> 01:35.230 Cool, but it doesn't look perfect. 01:35.880 --> 01:37.980 Let me align the verbs a little bit. 01:41.690 --> 01:43.510 Now, it looks better by now. 01:43.550 --> 01:48.110 I think you understand that each character here is actually a court point or a room. 01:48.710 --> 01:55.220 For example, as I said, six to five represents the capital, a character or six to six represents 01:55.220 --> 01:56.600 the capital B character. 01:56.600 --> 01:57.170 And so. 01:58.160 --> 02:03.350 OK, now I'm going to print the court points as hexadecimal numbers here. 02:03.380 --> 02:05.870 I'm going to use the X verb LACHSA. 02:07.090 --> 02:10.060 So that it will print the court point in hexadecimal. 02:11.610 --> 02:16.290 Also, for example, the hexadecimal code point of view is for a. 02:17.610 --> 02:23.130 Lastly, let's print the UTF eight encoded representation of the court points in hexadecimal. 02:25.880 --> 02:33.950 OK, here, by this extra space, print will print the bytes separated by space when you convert a code 02:33.950 --> 02:35.020 point to a string. 02:35.030 --> 02:39.900 Like so go encodes it to UTF eight string value automatically. 02:40.550 --> 02:44.420 So here it will print the encoded bytes of the code point. 02:45.560 --> 02:46.520 So far, so good. 02:47.120 --> 02:50.670 Now let's accept the court point range from the user. 02:51.410 --> 02:56.390 Let me first change the types of these variables to insert here. 02:56.420 --> 03:00.370 I'm going to check whether there are two common line arguments or not. 03:01.190 --> 03:05.060 If so, I'm going to set the starting point to give an argument. 03:05.750 --> 03:08.030 I'm also going to set the stopping point. 03:08.570 --> 03:13.430 This is why I have changed the type of the start and stop variables to insert. 03:14.030 --> 03:18.580 It was because a Twohy function returns int Laslett. 03:18.590 --> 03:21.860 I'm going to check whether there are incorrect cut points. 03:22.460 --> 03:29.450 If so, I'm going to reset them to some defaults like so as you can see, I can assign room literals 03:29.450 --> 03:33.080 to int variables because literals are timeless. 03:33.830 --> 03:38.600 So there's room literals get converted to int values automatically. 03:39.560 --> 03:47.450 Let's first try it with the defaults good, it works now let's print the ASCII character set. 03:48.050 --> 03:54.980 The ASCII standard is a part of Unicode standard and each code point in the ASCII standard is one byte 03:54.980 --> 03:55.370 long. 03:56.120 --> 04:03.730 For example, the space character equals to 32 or the zero character equals to forty eight and so on. 04:04.340 --> 04:06.680 So they can fit into one bytes. 04:07.580 --> 04:14.420 Askey is good and easy to work with, and it can represent the English letters, numbers and some other 04:14.420 --> 04:17.140 fundamental characters using only a single bite. 04:17.420 --> 04:22.900 However, in real life, you may need to work with languages other than English as well. 04:23.180 --> 04:27.080 And they usually use multiple byte code points, for example. 04:27.200 --> 04:30.200 Now I'm going to print the extended lighting called points. 04:30.710 --> 04:33.440 As you can see, each code point is one byte. 04:33.680 --> 04:37.870 However, when they are UTF eight encoded, they become too whites. 04:38.690 --> 04:44.570 So you can store each one of these code points in a single byte, but whenever you want to print them, 04:44.600 --> 04:45.860 you need to bytes. 04:46.190 --> 04:51.120 Remember, a bot can store a number between zero and 255. 04:51.800 --> 04:56.480 For example, this room has a code point that can fit into one byte. 04:57.230 --> 05:04.160 These two hexadecimal digits represent only one byte and they are equal to one hundred and six to one. 05:04.940 --> 05:12.410 However, when this room is UTF eight in code, it it cannot fit into a bottle anymore because UTF eight 05:12.410 --> 05:16.390 encoding for this room requires two bytes anyway. 05:16.650 --> 05:20.720 Now I'm going to print some more code points that require more than one byte. 05:23.920 --> 05:29.800 As you can see this time, each court point is to whites and one UTF eight in caudate, they become 05:29.800 --> 05:30.520 three bites. 05:31.420 --> 05:35.830 So, for example, this rule cannot be stored in a single by black. 05:35.870 --> 05:38.410 So as you can see, there is an error. 05:39.100 --> 05:41.200 It overflows the bite variable. 05:42.520 --> 05:45.040 But you can store it in a room type like so. 05:47.080 --> 05:51.400 The default type of a run literal is run type, so I can do it lachsa. 05:52.390 --> 05:58.510 Anyway, lastly, let's take a look at a few emoji called points, this time each Growthpoint point 05:58.510 --> 06:02.470 is three bytes and one UTF eight encoded they become for whites. 06:03.340 --> 06:06.390 This is the maximum size of a court point for UTF eight. 06:06.910 --> 06:12.490 So using UTF eight, you can represent code points between one and for whites. 06:13.300 --> 06:19.750 So I can store one of these code points in a room variable like so as you can see, it still works. 06:20.650 --> 06:27.730 So in summary, if you want to represent any Unicode code point, you can use the rune type and rune 06:27.730 --> 06:31.210 literals because it can store A'Court Point up to four watts. 06:31.960 --> 06:32.590 All right. 06:32.620 --> 06:33.480 That's all for now. 06:34.270 --> 06:37.090 Please write some of the other blocks here by yourself. 06:37.270 --> 06:41.780 Print them and investigate their code points and encoded bytes and so on. 06:42.370 --> 06:43.700 OK, bye for now.