Failed to execute ‘setRequestHeader‘ on ‘XMLHttpRequest

When the front-end page sends a request to the background, Chinese is put in the request header, that is, the header , so there will be encoding format problems

Error message:

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

solution:

Encoding: encodeURIComponent (str)
Decoding: decodeURIComponent (str)

Guess you like

Origin blog.csdn.net/weixin_43614065/article/details/123865464