URL编码—扩音器和问题 [英] URL Encoding—Ampersand Problem
问题描述
我在使用某些字符编码时遇到了一些麻烦,导致我的网站上的搜索表单出现了一些问题.可能的字段值之一在其中有一个&符.选择此项并提交搜索后,&"号编码为:%2526
I'm having some trouble with some character encoding causing some problems with a search form on my website. One of the possible field values has an ampersand in it. When this is selected and a search is submitted the ampersand is encoded to: %2526
使用页面底部的分页链接并导航到结果列表中的第二页,&"号编码为:%26
Upon using the pagination links at the bottom of the page and navigating to the second page in the list of results the ampersand is encoded to: %26
最后...试图导航到列表中的第3页,&"号又改回了:&
这打破了形式,因为它假定确实存在一个不存在的变量.
Finally...in an attempt to navigate to the 3rd page in the list the ampersand is changed back to: &
This breaks the form as it assumes there's a variable that isn't actually there.
为什么编码会更改?我怎样才能解决这个问题?感谢您的帮助!
Why is the encoding changing? How can I fix this? Thanks for your help!
推荐答案
该字段似乎已被编码两次.首次通过将导致&更改为%26,则urlencoding%26将产生%2526,因为%本身的编码为%25.
It looks like the field is being encoded twice. First pass will result in & changed into %26, then urlencoding %26 will result in %2526, since the encoding for % itself is %25.
这篇关于URL编码—扩音器和问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!