Why Utf8 is compatible with ascii

后端 未结 3 1310
一向
一向 2021-02-08 04:16

A in UTF-8 is U+0041 LATIN CAPITAL LETTER A. A in ASCII is 065.

How is UTF-8 is backwards-compatible with ASCII?

3条回答
  •  爱一瞬间的悲伤
    2021-02-08 04:46

    Why:

    Because everything was already in ASCII and have a backwards compatible Unicode format made adoption much easier. It's much easier to convert a program to use UTF-8 than it is to UTF-16, and that program inherits the backwards compatible nature by still working with ASCII.

    How:

    ASCII is a 7 bit encoding, but is always stored in bytes, which are 8 bit. That means 1 bit has always been unused.

    UTF-8 simply uses that extra bit to signify non-ASCII characters.

提交回复
热议问题