UTF8编码? [英] UTF8 Encoding?

查看:177
本文介绍了UTF8编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是UTF-8编码,为什么以此格式保存的文本文件比其他文件更大?

What is UTF-8 encoding and why text files saved in this Format are more bigger than the other?

例如我在记事本中键入了A并以UTF-8格式保存。

For example I had typed 'A' in the notepad and save it in UTF-8 format.

之后,文件大小变为:4个字节。为什么?

After that, The file size turns to : 4 bytes . why?

推荐答案

几乎可以肯定,因为你使用保存文件还包括字节顺序标记,在UTF-8中为0xEF 0xBB 0xBF。

It's almost certainly because whatever you're using to save the file is also including the byte order mark which in UTF-8 is 0xEF 0xBB 0xBF.

-8是 - 这是一个Unicode编码,使用更高的Unicode值逐渐增加字节;重要的是,ASCII字符存储为单字节(与ASCII中的字节相同)。所以任何ASCII文件也是一个具有相同文本的UTF-8文件。 此网页有更多内容,维基百科

As for what UTF-8 is - it's a Unicode encoding which uses progressively more bytes for higher Unicode values; importantly, ASCII characters are stored as single bytes (the same bytes as they would be in ASCII). So any ASCII file is also a UTF-8 file with the same text. This web page has more, as does Wikipedia.

这篇关于UTF8编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆