[英]javascript encodeURI() output
According to MDN , The 'encodeURI()' function:根据MDN ,'encodeURI()' 函数:
replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character用一个、两个、三个或四个表示字符的 UTF-8 编码的转义序列替换某些字符的每个实例
However, when invoking encodeURI('\')
(in Chrome) Im getting %C2%81
as output.但是,当调用encodeURI('\')
(在 Chrome 中)时,我将%C2%81
作为输出。
I expected to get %82
or %00%82
.我希望得到%82
或%00%82
。 What does the %C2
mean? %C2
是什么意思?
The '0082' in '\' is the Unicode code point, not the UTF-8 bytes representation. '\' 中的 '0082' 是Unicode代码点,而不是 UTF-8 字节表示。 UTF-8 maps u+0082
code point to two bytes: C2+81
UTF-8 将u+0082
码点映射到两个字节: C2+81
Decoding %C2
at http://www.albionresearch.com/misc/urlencode.php leads to Â
在http://www.albionresearch.com/misc/urlencode.php解码%C2
导致Â
When dealing with German texts and ISO 8859-15 / ISO 8859-1 vs. UTF-8 I often ran into the Ã
character.在处理德语文本和 ISO 8859-15 / ISO 8859-1 与 UTF-8 时,我经常遇到Ã
字符。 The characters are quite close to each other.角色之间非常接近。 May this also be an encoding problem?这也可能是编码问题吗?
Maybe HTML encoding issues - "Â" character showing up instead of " "可能是HTML 编码问题 - 显示“”字符而不是“ ” helps.有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.