Failed to execute ‘setRequestHeader‘ on ‘XMLHttpRequest

在前端页面发送request请求到后台时,请求头即header中放入了中文,所以就会出现编码格式问题

报错信息:

Failed to execute ‘setRequestHeader’ on ‘XMLHttpRequest’: String contains non ISO-8859-1 code point.

解决方案:

编码 : encodeURIComponent(str)
解码 : decodeURIComponent(str)

猜你喜欢

转载自blog.csdn.net/weixin_43614065/article/details/123865464