我有一个表格,如果我只填写英文字符,一切都还可以,但如果我试着填写一些汉字,那么就会出现问题:
如果在chrome或firefox中填写表单,则会发送以下请求:
/ docsearch / documents / site / test / documentLibrary /?filter = path&amp; filterData =%2F&amp; size = 50&amp; pos = 1&amp; prop_cm_name =%E4%B8%AD%E5%9B%BD HTTP / 1.1 < / p>
如果在IE中填写表单,则会发送以下请求: / doclib / docsearch / documents / site / test / documentLibrary /?filter = path&amp; filterData =%2F&amp; size = 50&amp; pos = 1&amp; prop_cm_name = \ 326 \ 320 \ 271 \ 372 HTTP / 1.1
正如您所看到的,相同的中文字符在IE和Firefox中可以有不同的编码。有人能告诉我如何让IE发送与firefox / chrome相同的请求吗?
编辑表格:
<form action="" enctype="application/json" accept-charset="utf-8" method="post" id="template_x002e_toolbar_x002e_documentlibrary-form" forms-runtime="listening" onsubmit="return false;">
<div class="form-fields" id="template_x002e_toolbar_x002e_documentlibrary-form-fields">
<div class="form-field">
<label for="template_x002e_toolbar_x002e_documentlibrary_prop_cm_name">Name:</label>
<input type="text" title="Name" value="" tabindex="0" name="prop_cm_name" id="template_x002e_toolbar_x002e_documentlibrary_prop_cm_name">
</div>
</form>
IE似乎将这些字符视为Unicode,而不是按照表格中的参数将其视为UTF8?
答案 0 :(得分:0)
您可能需要从enctype
元素中删除form
属性,或为其选择以下值之一:
您正在使用的值application/json
可能会导致您看到的差异,因为不同的浏览器可能会以不同的方式处理enctype
属性的未知值。
有关详细信息,请参阅here。