I am trying to add some headers in my request. But header values may include some Turkish characters (like ğ, ş, ö etc.) and when I tried this, I got this error:
TypeError: Failed to execute 'setRequestHeader' on 'XMLHttpRequest': String contains non ISO-8859-1 code point.
at setRequestHeader (xhr.js:132)
at Object.forEach (utils.js:253)
at dispatchXhrRequest (xhr.js:126)
at new Promise (<anonymous>)
at xhrAdapter (xhr.js:13)
at dispatchRequest (dispatchRequest.js:52)
at :3000/report/async http:/localhost:3000/static/js/main.chunk.js:4137
I guess axios supports ISO-8859-1 characters when add my custom headers to header list. Is it possible change axios' supported charset to UTF-8?
let headers = {"userId": user.id, "username":user.username, "relatedName": encodeURIComponent(values.username)}; Encode at React. relatedName = URLDecoder.decode(request.getHeader("relatedName"), StandardCharsets.UTF_8.name()); Decode at Java.