本文介绍了“+”之间的区别和“%A0” - urlencoding?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个url编码的字符串传递给一个函数。但是,它将第二个空格编码为%A0。这意味着当我解码字符串时,%A0在黑匣子中显示为问号。

I am url encoding a string of text to pass along to a function. However, it encodes the second space in a double-space as "%A0". This means that when I decode the string, the "%A0" is displayed as a question mark in a black box.

我真的只需要能够删除额外的空间,但我想了解是什么导致这一点,以及如何正确处理它。

I really just need to be able to remove the extra space, but I'd like to understand what is causing this and how to handle it correctly.

例如:

For example:

Something  Something else

编码为:

Something+%A0Something+else


推荐答案

%A0 表示一个NBSP(U + 00A0)。 + 表示正常空间(U + 0020)。 NBSP显示为替换字符(U + FFFD),因为字符的编码与页面的编码不匹配,所以其字节序列对页面无效。

%A0 indicates a NBSP (U+00A0). + indicates a normal space (U+0020). The NBSP displays as a replacement character (U+FFFD) because the encoding of the character does not match the encoding of the page, so its byte sequence is not valid for the page.

这篇关于“+”之间的区别和“%A0” - urlencoding?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-05 10:21