Tag Archives: Failed to execute ‘setRequestHeader’ on ‘XMLHttpRequest

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

When the front-end page sends a request to the background, non-english is put into the request header, so there will be coding 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)