8000 GitHub - incanus/learn-utf8
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

incanus/learn-utf8

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Learn how UTF-8 encoding works

A small coding example inspired by UTF-8: Bits, Bytes, and Benefits.


============================================================

Decimal:    65
Hex:        41
Binary:     01000001

Type:       ASCII (high bit of all bytes is false)

Render:     A

============================================================

Decimal:    240 159 152 141
Hex:        F0 9F 98 8D
Binary:     11110000 10011111 10011000 10001101

Type:       UTF-8 (high bit of all bytes is true)

            There are four bytes total because the first four bits are set:
            11110___ ________ ________ ________

            4 UTF-8 bytes contain 21 bits of info:
            11110___ 10______ 10______ 10______

            That info is:
            _____000 __011111 __011000 __001101

            Those bits concatenated are:
            000011111011000001101

            Which in hex is:
            01 F6 0D

            Which means the UTF-8 code point is:
            U+1F60D

Render:     😍

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0