Unicode 和 UTF-8 有什么区别? [英] What's the difference between Unicode and UTF-8?

查看:30
本文介绍了Unicode 和 UTF-8 有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑:

unicode=utf16 是真的吗?

许多人说 Unicode 是一种标准,而不是一种编码,但实际上大多数编辑器都支持另存为 Unicode 编码.

Many are saying Unicode is a standard, not an encoding, but most editors support save as Unicode encoding actually.

推荐答案

大多数编辑器实际上支持另存为Unicode"编码.

most editors support save as ‘Unicode’ encoding actually.

这是 Windows 犯下的一个不幸的错误命名.

This is an unfortunate misnaming perpetrated by Windows.

因为 Windows 内部使用 UTF-16LE 编码作为 Unicode 字符串的内存存储格式,所以它认为这是 Unicode 文本的自然编码.在 Windows 世界中,有 ANSI 字符串(当前机器上的系统代码页,受制于完全不可移植性)和 Unicode 字符串(内部存储为 UTF-16LE).

Because Windows uses UTF-16LE encoding internally as the memory storage format for Unicode strings, it considers this to be the natural encoding of Unicode text. In the Windows world, there are ANSI strings (the system codepage on the current machine, subject to total unportability) and there are Unicode strings (stored internally as UTF-16LE).

这一切都是在 Unicode 早期设计的,在我们意识到 UCS-2 不够用之前,并且在发明 UTF-8 之前.这就是为什么 Windows 对 UTF-8 的支持全面较差的原因.

This was all devised in the early days of Unicode, before we realised that UCS-2 wasn't enough, and before UTF-8 was invented. This is why Windows's support for UTF-8 is all-round poor.

这种误导性的命名方案成为用户界面的一部分.使用 Windows 编码支持提供一系列编码的文本编辑器会自动且不恰当地将 UTF-16LE 描述为Unicode",将 UTF-16BE(如果提供)描述为Unicode big-endian".

This misguided naming scheme became part of the user interface. A text editor that uses Windows's encoding support to provide a range of encodings will automatically and inappropriately describe UTF-16LE as "Unicode", and UTF-16BE, if provided, as "Unicode big-endian".

(其他自己编码的编辑器,比如 Notepad++,没有这个问题.)

(Other editors that do encodings themselves, like Notepad++, don't have this problem.)

如果它让您感觉更好,ANSI"字符串也不基于任何 ANSI 标准.

If it makes you feel any better about it, ‘ANSI’ strings aren't based on any ANSI standard, either.

这篇关于Unicode 和 UTF-8 有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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