Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用带有特殊字符和口音的axios处理装载请求_Java_Spring Boot_Vue.js_Http_Axios - Fatal编程技术网

Java 如何使用带有特殊字符和口音的axios处理装载请求

Java 如何使用带有特殊字符和口音的axios处理装载请求,java,spring-boot,vue.js,http,axios,Java,Spring Boot,Vue.js,Http,Axios,在使用VUE.JS构建的网页形式中,使用Axios装载GET请求 根据表单某些字段的值,可能会有特殊字符和重音 例如,如果在姓氏表单字段中,用户写入“Ruíz”,则请求的装载方式如下: http://localhost:9000/someController?surname=Ru%C3%ADz 似乎“í”已转换为%C3%AD 这是我在Java端的控制器中所做的: @RequestMapping(method = RequestMethod.GET) @ResponseBody public S

在使用VUE.JS构建的网页形式中,使用Axios装载GET请求

根据表单某些字段的值,可能会有特殊字符和重音

例如,如果在姓氏表单字段中,用户写入“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编码相关的东西


谢谢

我找到了一个解决方案,使用了org.apache.commons.lang.StringEscapeUtils.unescapeHtml()

但我不知道是否存在另一种更“干净”的方法,例如基于@annotations

System.out.println(surname); //This gives me unproper: Ruíz
                
String unescapedSurname = StringEscapeUtils.unescapeHtml(surname);
System.out.println(unescapedSurname); //This gives me the proper: Ruíz

您需要在服务器上使用
decodeURIComponent('Ru%C3%ADz')
对其进行转换。谢谢你们的评论