今天项目中某个某块添加功能突然报错了,看了下后台日志报。报了 Illegal hex characters in escape (%) pattern For input "......" 。由于浏览器会对特殊符号转义,所以我们在对特殊符号 # % # @ 保存至后台时,需要转义,页面上使用encodeurlCompoment(),java 后台使用 str.decode(str,'utf-8'),这个api对%,+ 会报Illegal hex characters in escape (%) pattern 错误,所以我们需要对str做正则替换 name = name.replaceAll("%(?![0-9a-fA-F]{2})", "%25");
Illegal hex characters in escape (%) pattern
猜你喜欢
转载自blog.csdn.net/asonFirst/article/details/103137157
今日推荐
周排行