https://stackoverflow.com/questions/3951722/whats-the-difference-between-unicode-and-utf-8

If asked the question, "What is the difference between UTF-8 and Unicode?", would you confidently reply with a short and precise answer? In these days of internationalization all developers should be able to do that. I suspect many of us do not understand these concepts as well as we should. If you feel you belong to this group, you should read this ultra short introduction to character sets and encodings.

Actually, comparing UTF-8 and Unicode is like comparing apples and oranges:

UTF-8 is an encoding - Unicode is a character set

A character set is a list of characters with unique numbers (these numbers are sometimes referred to as "code points"). For example, in the Unicode character set, the number for A is 41.

An encoding on the other hand, is an algorithm that translates a list of numbers to binary so it can be stored on disk. For example UTF-8 would translate the number sequence 1, 2, 3, 4 like this:

00000001 00000010 00000011 00000100 

Our data is now translated into binary and can now be saved to disk.

All together now

Say an application reads the following from the disk:

1101000 1100101 1101100 1101100 1101111 

The app knows this data represent a Unicode string encoded with UTF-8 and must show this as text to the user. First step, is to convert the binary data to numbers. The app uses the UTF-8 algorithm to decode the data. In this case, the decoder returns this:

104 101 108 108 111 

Since the app knows this is a Unicode string, it can assume each number represents a character. We use the Unicode character set to translate each number to a corresponding character. The resulting string is "hello".

Conclusion

So when somebody asks you "What is the difference between UTF-8 and Unicode?", you can now confidently answer short and precise:

UTF-8 and Unicode cannot be compared. UTF-8 is an encoding used to translate numbers into binary data. Unicode is a character set used to translate characters into numbers.

所以,在git bash中使用file *命令查看文件格式的时候。显示的结果,首选是编码,然后是字符集

What's the difference between Unicode and UTF-8?相关推荐

  1. ASCII Unicode GBK UTF的联系

    快下班时,爱问问题的小朋友Nico又问了一个问题: "sqlserver里面有char和nchar,那个n据说是指unicode的数据,这个是什么意思." 并不是所有简单的问题都很 ...

  2. Unicode、UTF-8 和 ISO8859-1到底有什么区别(转载)

    本文主要包括以下几个方面:编码基本知识,java,系统软件,url,工具软件等. 在下面的描述中,将以"中文"两个字为例,经查表可以知道其GB2312编码是"d6d0 c ...

  3. 字符集ASCII、GBK、UNICODE、UTF在储存字符时的区别

    ASCII编码(American Standard Code for Information Interchange,美国信息互换标准代码),使用127个8进制字节表示英文和半角字符. GBK (Gu ...

  4. Unicode、UTF 和 ISO-8859-1等编码方式详解与浏览器URL编码

    将字符转换为二进制码的过程,我们称为编码,将二进制码转换为字符的过程,我们称为解码. 编码和解码时所采用的规则,我们称为字符集 常见的字符集: ASCII - 美国人编码,使用7位来对美国常用的字符进 ...

  5. unicode、utf区别

    字符集 首先,我们要明确2个概念,字符集和字符编码. 字符集:ASCII.GB2312.GBK.Unicode 字符编码:UTF-8.UTF-16.UTF-32 由于ASCII.GB2312.GBK不 ...

  6. 简单介绍Unicode和utf编码

    Unicode是一个字符集,码点范围为U+0000~U+10FFFF,共有1+2^20的取值空间,可以容纳超过100万个字符,至少需要21Bit(位)编码空间. 码点的意思是,这个字符集内的字符按序编 ...

  7. ansi、unicode、UCS、UTF等概念(转)

    一.ansi定义 不同的国家和地区制定了不同的标准,由此产生了 GB2312, BIG5, JIS 等各自的编码标准.这些使用 2 个字节来代表一个字符的各种汉字延伸编码方式,称为 ANSI 编码.在 ...

  8. core java 9 代码_Java Core 学习笔记——3.char/Unicode/代码点/代码单元

    通用字符集(UCS) UCS是由ISO制定的ISO 10646(或称ISO/IEC 10646)标准所制定的标准字符集. UCS包括了其他所有的字符集(包含了已知语言的所以字符). ISO/IEC 1 ...

  9. unicode,ansi,utf-8,unicode big endian编码的区别

    为什么80%的码农都做不了架构师?>>>    随便说说字符集和编码 快下班时,爱问问题的小朋友Nico又问了一个问题: "sqlserver里面有char和nchar,那 ...

最新文章

  1. Python初学者必学的20个重要技巧
  2. NAR:中科院微生物所发布全球模式微生物基因组测序计划进展
  3. android 悬停按钮,Android悬浮按钮的使用方法
  4. Python之父重回决策层,社区治理新方案!
  5. 计算机组成原理模拟试题,计算机组成原理模拟试题及答案
  6. bugku_本地包含
  7. ssm mysql增删改查_SSM配置并实现简单的数据库增删改查操作
  8. centos6 挂载ntfs格式移动硬盘
  9. 《算法第四版》学习心得一——怎么学算法
  10. 如何选择网页更新提醒工具
  11. windows环境下面批量修改文件夹名称
  12. python是最适合初学者的语言
  13. 【OpenCv】图像分割——分水岭算法
  14. 心形源码HTML,纯CSS实现心形加载动画(附源码)
  15. 微软宣布Windows更新计划,Win10将在2025年停止服务支持
  16. 数据库中码、超码、主码、候选码
  17. [Android]自定义绘制一个简易的音频条形图,附上对MP3音频波形数据的采集与展现
  18. 服务器架构项目计划书,VMware服务器虚拟架构实施方案计划书模板v2[1].0.doc
  19. Android9 framework 按键音调用流程及自定义按键音(替换原生按键音)和调节按键音音量的方法
  20. 对Apple Watch的取证分析(续)

热门文章

  1. java excel .do_Java Excel
  2. linux 如何查看fb中分辨率_西门子S71200,如何在FB块中使用操作定时器?
  3. java数字时钟控件_Java-数字时钟(简易版)
  4. html语言1002html语言,HTML基础和标签介绍
  5. os x php,OS X 安装php7.0
  6. oracle连接eclipse的包,【求助】eclipse导入了Oracle的驱动包连不上Oracle
  7. java 泛型 `<E extends Enum<E>>`
  8. vue 后台管理系统-创建项目
  9. SQLAlchemy Connection
  10. javascript window Timing