【发布时间】:2020-12-17 03:14:43
【问题描述】:
在使用 VUE.JS 构建的网页形式中,使用 Axios 挂载 GET 请求。
并且根据某些表单字段的值,可能会有特殊字符和重音符号。
例如,如果在 surname 表单字段中,用户写 'Ruíz',则请求是这样挂载的:
http://localhost:9000/someController?surname=Ru%C3%ADz
似乎'í'被转换为%C3%AD
这是我在 Java 方面的控制器:
@RequestMapping(method = RequestMethod.GET)
@ResponseBody
public SignerQueryResponse getSignerList(
@RequestParam(value = "surname", required = false) String surname,
HttpServletRequest request) {
//... all stuff
}
如何纠正?
我必须在服务器端放一些东西吗? .. 在 Java 控制器中??
...与 ISO-8859-1 编码有关的东西??
谢谢
【问题讨论】:
-
您需要在服务器上使用
decodeURIComponent('Ru%C3%ADz')进行转换。 -
This 应该有帮助
-
谢谢你们的cmets
标签: java spring-boot vue.js http axios