用下面的形式
<form target="dialogiframe" action="ConfigUpdate.cvx" id="TestForm"
name="TestForm" method="get">
<input name="test" type="text" size="40" value="A Sum 1+2=3"/>
<input type="submit" value="Set" />
</form>
发送请求的参数编码如下
test=A+Sum+1+2=3
解码后,它给出了错误的值“A Sum 1 2=3”,因为参数中的 + 未编码(= 也未编码),并且它被转换为空格。
如果我将方法更改为发布,则参数将正确编码为
test=A+Sum+1%2B2%3D3
然后正确转换。
我知道我应该使用 POST 并且确实正在浏览我的页面并正在转换它们,但是我是否遗漏了表单定义中的任何内容以使 GET 编码正确?
用 IE8 和 FF10 测试,<!DOCTYPE html> 中的页面
最佳答案
我认为这是使用 GET 作为表单方法的一个已知问题。通常,您应该对表单使用 POST 方法。
发件人:http://www.cs.tut.fi/~jkorpela/forms/methods.html
The official recommendations say that "GET" should be used if and only if the form processing is idempotent, which typically means a pure query form. Generally it is advisable to do so. There are, however, problems related to long URLs and non-ASCII character repertoires which can make it necessary to use "POST" even for idempotent processing.
关于html - 提交的表格未编码 +'s when using method="get",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9582470/