Unicode, in friendly terms: ASCII, UTF-8, code points, character encodings, and more

Поділитися
Вставка
  • Опубліковано 30 тра 2024
  • Ever been bit by a Unicode bug? Maybe you weren't treating UTF-8 encoded data correctly, or tried to read it as ASCII? Maybe you mixed up UTF-8 vs UTF-16? Unicode and character encoding might seem like a tricky topic, but let's break them down and learn about them piece by piece, from ASCII to code points to graphemes to combining character modifiers and more.
    Thumbs up emoji link: www.fileformat.info/info/unic...
    00:00 Intro
    00:12 All Data Is Stored As Bits
    00:41 How To Store Characters Using ASCII
    01:38 What About All The Other Languages?
    02:14 Graphemes Map To One Or More Code Points
    03:18 Code Points Map To One Or More Bytes
    03:44 UTF-32 Is Wasteful
    04:43 UTF-8 Is Better
    05:40 Unicode is Western-Language-Centric
    06:41 Mid-Video Recap
    07:52 Live Python Demo
    09:47 Unicode Rules Of Thumb
    10:14 Looking At A Code Point

КОМЕНТАРІ • 340

  • @edwincloudusa
    @edwincloudusa 2 роки тому +380

    this alone is the best unicode video explanation in the entire youtube, 100x better than the, maybe, second place from Computerphile.

    • @energy-tunes
      @energy-tunes 2 роки тому +10

      Computerphile's explanation was very concise as well. I don't understand why you are blatantly throwing shade on them like that lol

    • @ankitchabarwal6814
      @ankitchabarwal6814 Рік тому +10

      @@energy-tunes Computerphile presentation appears cluttered to me. While Alex seems to be tidy & to the point with flow reminiscent to that of a river.

    • @rz2374
      @rz2374 Рік тому +13

      @@ankitchabarwal6814 nothing about it is "cluttered". the difference is that computerphile covers the most important aspect of utf 8: how it knows how many bytes to read for multibyte codepoints, while this one leaves it out. i am not blaming this video, as it is a little confusing to explain, but this video is by no means the best.

    • @toraxmalu
      @toraxmalu Рік тому +2

      @@rz2374 It is best in one aspect: Keep it to the general encoding itself. Only one enhancement in aspect to UTF8: Pointing out to look for the UTF8-encoding strategy elsewhere…

    • @faizan9047
      @faizan9047 3 місяці тому

      i didnt understand clearly ... Can you explain me?

  • @EmilMacko
    @EmilMacko Рік тому +170

    Another fun fact about the way letters are laid out in ASCII: A capital letter's corresponding lowercase counterpart is exactly 32 values ahead. This is because 32 is a power of 2, and makes it so that you only need to flip the 6th bit (from the right) of a byte to change the case of a letter.

    • @Michael75579
      @Michael75579 Рік тому +22

      ASCII digits are also nicely laid out; the low nibble of characters '0' to '9' are 0 to 9.

    • @bororobo3805
      @bororobo3805 Рік тому +3

      Yup. You only need to XOR to flip back and forth

    • @bororobo3805
      @bororobo3805 Рік тому +4

      @@Michael75579 yup. You can subtract from '0' to get decimal equivalents.
      This is how most assembly programers do it

    • @qwert4871
      @qwert4871 7 місяців тому +4

      NOT ONLY ASCII
      I was going to say that it lost it's use in Unicode because it doesn't work with other alphabets, but went to check and… It works for Cyrillic and Greek as well!
      1101000010010000 is А (cyr)
      1101000010110000 is а
      1100111010010001 is Α (greek)
      1100111010110001 is α
      1101000010010110 is Ж
      1101000010110110 is ж
      Edit: Although it doesn't work for every character,
      1101000010101111 is Я and
      1101000110001111 is я

    • @thewelder3538
      @thewelder3538 7 місяців тому +1

      ​​@@bororobo3805That's not true, most programmers if they're good, will bitwise AND or OR rather than doing an arithmetic operation. With a barrel shifter, which most CPUs have, it will always be more efficient than using an arithmetic operation.

  • @1vader
    @1vader Рік тому +82

    7:50 Worth pointing out that Python 2 is way past its end of life now and in Python 3, all strings are Unicode aware and the u modifier does nothing (it's only there for backwards compatibility). Using Python 2 is a good way to showcase the difference between Unicode aware and unaware functions but seems like this could confuse some beginners trying to replicate what you're doing who will likely be using Python 3 and might not be aware of the difference.

    • @UpstreamNL
      @UpstreamNL Рік тому +9

      This also caught me off guard. Python 2 has been deprecated for such a long time by now.

    • @mokovec
      @mokovec Рік тому

      Only officially and even then was another point release considered. For some platforms there is no py3 port and plenty of py2 code is still around being used.

    • @1vader
      @1vader Рік тому +3

      @@mokovec It's definitely still out there but by now the official end of life has already been almost 3 years ago and it's finally dying for real. The consideration of "another point release" has long passed. On my distro, python 2 isn't installed by default anymore and on Windows, you need to really go out of your way to install it. Platforms where 2 is still the only option are far and few in between and certainly not the ones beginners are using. And there's definitely no reason to encourage starting to use it now.

    • @mokovec
      @mokovec Рік тому +1

      @@1vader I don't see anyone encouraging it.

    • @LC-hd5dc
      @LC-hd5dc Рік тому +2

      @@1vader this video is not a programming course, it's an explainer on utf-8.
      i assume he chose python2 on purpose specifically to demonstrate the differences in a simple language (so that a beginner wouldn't get too distracted by the syntax) that has an explicit delineation between unicode and non-unicode strings. of course we shouldn't be writing production ready code based off this video lol, and the video isn't encouraging it (he literally says "check out the applicable string behaviour and libs in your own language"); it's just a teaching tool

  • @winstonmisha
    @winstonmisha 2 роки тому +68

    FINALLY someone is able to explain this clearly. Most other videos complicate this so much. Thank you!

  • @menkiguo7805
    @menkiguo7805 Рік тому +36

    8:15 In python3, at least now it can do that with python without any problem.
    >>> a="你好"
    >>> a[0]
    '你'
    In python3, every string is in utf8. Using a u"" is a thing in py2

    • @spaghettiking653
      @spaghettiking653 Рік тому +3

      Technically, the internal representation of strings in Python is actually UTF-32 or UCS-4 (they're basically the same), because strings need to be efficiently indexable - as these encoding are uniform-length, that's easy to do. Using utf-8, the lookup of a given character in a string would take longer, because the whole string up to that point would need to be traversed as bytes are not evenly allocated to each character.
      To top things off, strings that only contain Latin characters just use ascii anyway internally to reduce waste. That's why when a string is appended to, it creates an entire new string object, as the characters the new string has to encode may be outside the original encoding's range.

  • @gt10i
    @gt10i 17 днів тому

    Great explanation, thank you! For anyone who may still not understand, UTF-8 CAN get up to 32 bits and bit as big as UTF-32, but only if it has to. Otherwise, it just uses the minimum amount of space (8 bits) and expands as required, depending on the grapheme.

  • @strandingstranger
    @strandingstranger 11 місяців тому +2

    you deserve a fucking award man, I swear, this is the top 1 explanation on UA-cam. NONE of the others are even close to yours.

  • @FlameRat_YehLon
    @FlameRat_YehLon Рік тому +13

    Traditionally major Chinese coding methods would just consider a Chinese grapheme as 2 characters though, because they would use 2 byte coding while the the 128 ASCII code points only use 1 byte coding. And also, traditionally a Chinese grapheme would always take up double the width of an ASCII grapheme in fixed width console font. This kinda makes everything neatly aligned (the amount of storage bytes needed is the same as the amount of character printing space needed), but basically falls apart when Internet and UTF-8 become more popular.
    And that's also basically the very reason there are double width Latin letters in Unicode. Traditionally it's used to improve readability of English words in vertical text arrangement for Chinese and Japanese, and is called full-width letters full width as in it's the full width of a Chinese character.

  • @learninggeekspeak384
    @learninggeekspeak384 2 роки тому +2

    Where have you been all my life?! 🤩 What a great explanation! Thank you so very much! 🥰

  • @darianleduc
    @darianleduc 2 роки тому +11

    I've listened to quite a few Unicode tutorials. This one blows the others out of the water. Clear. Concise. Good tempo. Thx

  • @sharbelokzan9673
    @sharbelokzan9673 Рік тому +5

    This is the type of content that should be suggested by UA-cam to everyone. Great explanation, thankyou

  • @Ma1ne2
    @Ma1ne2 Рік тому +2

    You have an amazing talent for teaching m8! Keep it up, this video like your others is so helpful. I love that you cover basic concepts of coding, not "how do I implement a server in node.js" but what really is the essence of becoming a good coder.

  • @chatopaniagua
    @chatopaniagua Рік тому

    I've watched a few videos today trying to understand these concepts and this is by far the best. Good job

  • @tanzimchowdhury320
    @tanzimchowdhury320 9 місяців тому

    Man this channel is golden. The most difficult topics here are explained so easily and in such a unique way

  • @florianvanbondoc3539
    @florianvanbondoc3539 Рік тому +3

    This video is like the sum of the most important things about unicode and ascii, very well done.

    • @oni741
      @oni741 Місяць тому +1

      👍👍🏾

  • @user-lb1ib8rz4h
    @user-lb1ib8rz4h Рік тому

    this is such an appealing video due to the detail, music, subtle animations, even the colour theme. thanks for the video!

  • @GaGaGooGik
    @GaGaGooGik Рік тому +6

    at 1:49 the arabic is rendered incorrectly. it shows each letter in the isolated form instead of the connected forms.

    • @cs127
      @cs127 Рік тому +3

      and it's written from left to right instead of right to left

    • @LC-hd5dc
      @LC-hd5dc Рік тому

      happens every time lol, i remember some big project did the same thing recently

  • @MahmoudKhudairi
    @MahmoudKhudairi Рік тому +7

    I took a long searching to understand the Unicode (also UTF-8 and the others), I did, but some things were still ambiguous to me, this guy literally taught me the whole topic with only 10 minutes

  • @luzzyommm
    @luzzyommm 2 роки тому

    This is the best explanation of unicode and UTF-8. Super comprehensive & helpful! Thanks!

  • @Mrlino091
    @Mrlino091 11 місяців тому

    This video packed so much information in such a short amount of time, amazing. Thank you for this content and please keep uploading,

  • @AJD...
    @AJD... Рік тому +2

    Absolutely love this explanation. As someone else mentioned, this is even better than Tom Scott's explanation on the numberphille channel.

  • @istaka1
    @istaka1 Рік тому

    This is such a great explainer video. As somebody who's run into the codepoint slicing problem in Python a lot. This explains so much! Thank You again!

  • @KevinAMathew
    @KevinAMathew Рік тому

    Definitely the best explanation of Unicode I could ask for. Checked with Elixir and it appears that Elixir stringս are Unicode aware by default! Amazing!

  • @jayyan5617
    @jayyan5617 2 роки тому +3

    wow your Chinese pronuciation is pretty good there @2:24

  • @jimmoriarty3381
    @jimmoriarty3381 2 роки тому +4

    Terrific video dude, definitely deserves far more views

  • @javascriptwithjames810
    @javascriptwithjames810 2 роки тому +2

    This is so awesome yet somehow has so few views.
    These kind of videos are amazing for people self-studying CS. I hope you have lots more videos like this to make it easier.
    Keep up the great work 🤘

    • @StudyingWithAlex
      @StudyingWithAlex  2 роки тому

      Glad you liked it! Any topic suggestions for future videos?

  • @maksiksq
    @maksiksq Рік тому

    The atmosphere in the video is so chill, and the video is informative, UA-cam recommend this to more people.

  • @dhrubajyotimandal
    @dhrubajyotimandal 14 днів тому

    Best explanation with a fantastic presentation. Thank you so much

  • @Mehraj_IITKGP
    @Mehraj_IITKGP 10 місяців тому +2

    Thanks, a ton!!
    Here is what I learnt from the video (I have added a few things that I knew earlier):
    - UTF-8 (Unicode Transformation Format, 8-bit) is an encoding scheme for representing Unicode characters.
    - In UTF-8, ASCII characters are represented using a single byte, which means that any valid ASCII text is also valid UTF-8 text.
    - Therefore, UTF8 is backward compatible with ASCII.
    - In UTF-8, characters that can be represented using a single byte (i.e., ASCII characters) are represented as themselves.
    - Characters that require more than one byte are encoded using a combination of multiple bytes.
    - A code point refers to a numerical value assigned to each character or symbol in the Unicode standard.
    - Code points are represented using hexadecimal notation and are typically prefixed with "U+" to distinguish them from other numerical values.
    - For example, character "é" (Latin Small Letter E with Acute) consists of two Unicode code points: the base character "e" (U+0065) and the combining acute accent (U+0301). When encoded in UTF-8, "é" is represented by the bytes 0xC3 0xA9.
    - A grapheme refers to a visual unit of a written language. It represents a single user-perceived character or a combination of characters that are displayed together.
    - len() function returns the number of bytes, not the number of characters in a Unicode-unaware string.
    - len() function returns the number of characters in case of a Unicode-aware string.

    • @ShawnTheSheep407
      @ShawnTheSheep407 8 місяців тому

      thanks for posting the summary here

    • @jdog370
      @jdog370 5 місяців тому

      The notes on pythons functions are wrong as they are for a much earlier version that has not been in use for half a decade

  • @leandersmainchannel4493
    @leandersmainchannel4493 Рік тому

    I have waited for this type of video for years, thank goodness you made one!

  • @67hutch
    @67hutch 2 роки тому +1

    Excellent video! Explained everything in a way that I could understand very well, thank you :)

  • @Caellyan
    @Caellyan 6 місяців тому

    I kinda hoped this video would teach me how to use all the unicode characters in 11min, but it turns out it's just a general overview of how UTF-8 works. This is like going to a math class and learning that addition exists, but not learning how to use the + man.

  • @brettwines6812
    @brettwines6812 2 роки тому +4

    loved this video! So so clear ✨

  • @user-qr8gx2kx9q
    @user-qr8gx2kx9q 2 роки тому +1

    Easy to digest explanation! Good job, thanks 👍

  • @js34lee
    @js34lee Рік тому

    Trying to be better in IT and dreaming to be an awesome programmer! I have always just skipped on learning Unicode and never cared due to laziness. But now realize the very importance! thank you so much for this video.

  • @oppenheimjm
    @oppenheimjm 7 місяців тому

    Very useful and applicable explanation of ASCII, UTF and UNICODE

  • @jondo7680
    @jondo7680 2 місяці тому

    The reason I'm going to watch this one is that it explains new stuff like Emojis without expecting already having knowledge about Unicode. Bad informative material usually either lacks the new stuff or expected to much knowledge about the old.

  • @terrycody8743
    @terrycody8743 Рік тому

    Such best videos better than 100X bad books, I can't stress too much how good this video is. There are always treasure videos like this on UA-cam, hope OP keeps working, keep letting your knowledge and legacy to influence more people.

  • @mohanradu
    @mohanradu 2 роки тому

    Very good explanation. Clearly deserves more views.

  • @FabielCasas
    @FabielCasas Рік тому

    Hey thanks for the explanation; I spent some time understanding the Unicode with the tables ASCII table but this explanation is really good. Thanks.

  • @dorancampbellscreativecorn9091

    I hit the (U+1F44D) button because this video was so easy to understand!

  • @epicgameryt4052
    @epicgameryt4052 Рік тому

    honestly thought you had a million subs. quality is top notch.

  • @chengjoseph9459
    @chengjoseph9459 9 місяців тому

    been using Unicode for so long but never really understood what it means. Thanks for explaination.

  • @sanchit8818
    @sanchit8818 2 роки тому

    Thanks for showing actual code.. it made it very easy to understand

  • @marvelousoyiboluawhore202
    @marvelousoyiboluawhore202 10 місяців тому

    Great video. Thanks for explaining this clearly. This is the best video on Unicode

  • @ryansamarakoon8268
    @ryansamarakoon8268 Рік тому

    this is the best video I've seen for how unicode works! Thanks!

  • @sujanmaharjan5838
    @sujanmaharjan5838 Рік тому

    This is the best explaination of Unicode.👏🏼👏🏼👏🏼

  • @mishraw
    @mishraw Рік тому

    Your tutorial videos are amazing. I decided to go back to creating soft after 16 years. soft soft is so easy to get into, but also offers

  • @AnantaAkash.Podder
    @AnantaAkash.Podder Рік тому

    Excellent Explanation Man... Understood every bit of it... Many Many Thanks😊❤️

  • @program8754
    @program8754 2 роки тому

    Very good explanation , thank you for your work!

  • @sany2k8
    @sany2k8 2 роки тому

    Quality content, awesome. Post more these kind of great explainable video

  • @noncausaltalks
    @noncausaltalks 4 місяці тому

    So much informative video, thank you for creating such a video, and also salute to your effort for making this video. 👍 ❤

  • @rupamkerketta4735
    @rupamkerketta4735 2 роки тому +1

    Beautifully Explained

  • @stachowi
    @stachowi Рік тому

    wow, best explanation i've seen... short and accurate. Bravo.

  • @rachidachahbi4959
    @rachidachahbi4959 Рік тому

    thank you so much alex , great and lucid explanation .

  • @Akimb321
    @Akimb321 7 місяців тому

    This was very informative and clear. Thank you.♥

  • @imaginecloudsxo7987
    @imaginecloudsxo7987 2 роки тому

    Damn, that was such an amazing video!!! Learned so much from this, wish my lecturers would've explained it like that as well ahah

  • @SamarthCat
    @SamarthCat Рік тому +1

    Thanks, this video really helped me understand text encoding better.
    I'm a programmer so this knowledge is really useful :)

  • @kapilch
    @kapilch Рік тому

    cleared all my doubts. best explanation on the entire universe :)

  • @eliudiaz7469
    @eliudiaz7469 2 роки тому +1

    Absolutely amazing video. Good Job 👍.

  • @kellybmackenzie
    @kellybmackenzie Рік тому

    Thank you so much, this helped a lot!! You're a great teacher, your explanation was amazing!!

  • @mandresyfalimanana3538
    @mandresyfalimanana3538 Рік тому

    Such clean video format for explanning clearly a knowledge ! Thank you^^ (by a newcomer in the field of informaticL
    May you have a nice day with cookies and tea/milk 🥛🍪

  • @mattp6460
    @mattp6460 Місяць тому

    no videos were explaining clearly the step of converting the "grapheme" to a "code point" and then to binary they were just assuming that middle step was understood. that's what I was missing apparently thanks great video

  • @tastyw0rm
    @tastyw0rm Рік тому

    Brilliant explanation Alex, thank you

  • @ahmedhafez8698
    @ahmedhafez8698 Рік тому

    Beautiful man, you're the only one who helped me

  • @njengathegeek
    @njengathegeek Рік тому

    This is so nicely explained

  • @bc4198
    @bc4198 Рік тому

    Excellent, thank you - helpful and interesting!

  • @manjunathhuchappa3808
    @manjunathhuchappa3808 Рік тому

    Amazing explanation about Unicode

  • @turner7777
    @turner7777 2 роки тому +1

    WHY? WHY? WHY HAVENT I SEEN YOUR CHANNEL, YOU ARE THE BEST HANDS DOWN, definitely sub + bell (and like)
    just the way you explain.. its so good and clear

    • @markcuello5
      @markcuello5 2 роки тому

      Yeah, I don`t know what is going on with my channel. Is UA-cam ripping me off? I know the Freedom Fighters [world-wide] are.

  • @shoooozzzz
    @shoooozzzz 9 місяців тому

    The clearest Unicode has ever been in my career!

  • @yocracking8586
    @yocracking8586 2 роки тому

    Thank you.. this was easy to understand with your explanation

  • @eltongarcia6105
    @eltongarcia6105 7 місяців тому

    Amazing job! thank you again!

  • @afthabkpaseeskp406
    @afthabkpaseeskp406 Рік тому

    i really apreciate your help with dowloanding this software

  • @adhikapriyanto7432
    @adhikapriyanto7432 Рік тому

    Hey! Thanks so much for this video!

  • @Avocado.777
    @Avocado.777 Рік тому

    great content, it's much more clear now. Thxxxxxxx

  • @mpramod1305
    @mpramod1305 Рік тому

    Awesome explanation 👍

  • @miggu
    @miggu 8 місяців тому

    Great video , made me understand finally.

  • @cut-a-lyst
    @cut-a-lyst Рік тому

    subbed because of this wonderful explanation
    thanks

  • @charupathdrawingacademy3215

    TNice tutorials one is really good, among all other basics videos

  • @ageingdragon8132
    @ageingdragon8132 Рік тому

    Thank you so much for this!

  • @Bazal7511
    @Bazal7511 Рік тому

    Thanks man!! You've earned my respect

  • @wishthere1
    @wishthere1 Рік тому

    Your videos have helped reach over $200,000 in stocks by age 23! Thanks In The setup. Keep the videos coming.

  • @friendlybear5924
    @friendlybear5924 Рік тому

    Great video, thank you!

  • @mbekezelisibanda3641
    @mbekezelisibanda3641 2 роки тому

    SO MUCH HELP WITH THIS VIDEO

  • @ShahidHussain-wj1jy
    @ShahidHussain-wj1jy 3 місяці тому

    Amazing video!

  • @johnfred8101
    @johnfred8101 Рік тому

    Hi! This is Gold! Please do more videos like this. especially the terminal colors

  • @debuti
    @debuti Рік тому

    Thanks a lot! Best explanation ever

  • @darthvalber
    @darthvalber 2 роки тому

    Awesome video, thanks a lot!

  • @elliekong712
    @elliekong712 2 роки тому

    Thank you so much for the video, it really helps a lot!

  • @AnimeGIFfy
    @AnimeGIFfy Рік тому

    ok i finally understand why i need to specify utf 8 when writing to files

  • @CZghost
    @CZghost Рік тому

    I've got a paper that tells exactly how you can convert code point to UTF-8 bytes and vice versa. It's actually pretty good piece of knowledge and it tells exactly how UTF-8 encodes code points. Had I known that before, I could simply convert the Unicode symbols by hand myself.

  • @tarek1211
    @tarek1211 Рік тому

    Great video, the menu works great

  • @zohreabdellahi1045
    @zohreabdellahi1045 2 роки тому

    great explanation! it would be a good idea to explain how encoding would prevent in injection attacks.

  • @ziller601
    @ziller601 Рік тому

    yes it works brother ! many thanks

  • @joanlapeyra
    @joanlapeyra 5 місяців тому

    Fun fact: most writing systems can express their characters in 2 o 3 UTF-8 bytes (only 2 for the most used ones: extended latin, arabic, cyrilic, greek…). The only outlier is CJK Ideographs (Chinese, Japanese and Korean). There are an insane amount of them so each CJK grapheme carries more meaning (like a word) so it makes sense that they take more bytes in UTF-8 (usually 4 bytes).

  • @ranujawanigasinghe8697
    @ranujawanigasinghe8697 Рік тому

    Thank you Alex!

  • @ecommercetechbuild1354
    @ecommercetechbuild1354 Рік тому

    Best tutorial on Unicode

  • @joejnr7990
    @joejnr7990 7 місяців тому

    Awesome video

  • @mecrajib
    @mecrajib 10 місяців тому

    Thank you !

  • @ziadfawzi
    @ziadfawzi Рік тому

    Thank you so much.