IE浏览器URL中的查询条件中包含中文时报404的解决办法

时间:2023-03-08 21:59:56

情况是比如我输入如下URL到IE浏览器:

http://localhost:8090/RPT_TYSH_JL_ZD_DETAIL.html?pageIndex=1&year=2018&month=7&merAddress=鹿港

会出现404错误。

解决办法是:修改IE浏览器中的配置:

点击IE浏览器右上方的设置按钮 --> Internet选项 --> 高级 --> “国际*”中勾选上“发送 Intranet URL的UTF-8字符串”。

然后刷新(或重启)浏览器。

同时发现后端Spring MVC报错:“java.lang.IllegalArgumentException: Invalid character found in the request target. The valid charact”

解决办法是使用 encodeURIComponent() 函数。

参考链接:https://blog.****.net/testcs_dn/article/details/71716829

http://www.w3school.com.cn/jsref/jsref_encodeURIComponent.asp