I'm with a problem with accented words on a 'fetch'... I've tried so many things but nothing changed. Do you folks know how make this out?
The problem is, the accented words come in this value.label variable. I've tried putting the charset on the header, but nothing. The interesting thing is that the values are showed correctly on the request preview in the chrome's dev console.
This is the code I'm using:
fetch(url + params, {
method: "get"
})
.then(resp => resp.json())
.then(options => {
log(options.values());
options.forEach(value => {
self.append(`<option value="${value.valor}" >${value.label}</option>`);
});
});
This is the response from the webserver:
[{"label":"Sassarica Sapatilhas ","value":492},
{"label":"Sassarica Sapatilhas - Av Paulista","value":1547},
{"label":"Sassarica Sapatilhas - São Carlos","value":505}]
This is what i'm getting in the page:
Sassarica Sapatilhas - S�o Carlos
And this is the link for the CodePen: https://codepen.io/fabioamorim/pen/MZOByK