重定向URL乱码问题

问题:response.sendRedirect("http:/aaa.com/#/expressTracking?carCode=" + carCode);

     后台java代码重定向到后台一个路由,carCode中会出现中文,导致在前台接收的时候出现乱码

处理:后台添加编码:carCode = new String(carCode.getBytes(), "UTF-8");carCode = URLEncoder.encode(carCode, "UTF-8");

   前天添加解码:默认utf-8貌似不需要了carCode = decodeURI(carCode);

posted @ 2017-09-13 14:08  夏沫、微凉  阅读(207)  评论(0编辑  收藏  举报