什么是超长格式/编码? [英] What is exactly an overlong form/encoding?

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

问题描述

阅读有关UTF-8的维基百科文章,我一直在想词超长.该术语使用了很多次,但本文并未提供其含义的定义或参考.

我想知道是否有人可以解释该术语及其目的.

解决方案

这是对代码点的编码,该代码点占用了比所需更多的代码单元.

例如,U + 0020在UTF-8中由单个字节0x20表示.如果以常规方式解码两个字节0xc0 0xa0,您仍将返回U + 0020,但这是无效的表示形式.

Unicode更正#1 具有更多信息,尤其是有关表3.1B的信息./p>

Reading the Wikipedia article on UTF-8, I've been wondering about the term overlong. This term is used various times but the article doesn't provide a definition or reference for its meaning.

I would like to know if someone can explain the term and its purpose.

解决方案

It's an encoding of a code point which takes more code units than it needs to.

For example, U+0020 is represented in UTF-8 by the single byte 0x20. If you decode the two bytes 0xc0 0xa0 in the normal fashion, you'll still end up back at U+0020, but that's an invalid representation.

The Unicode Corrigendum #1 has more information, particularly around table 3.1B.

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

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