I'm receiving string from the back-end which is pokémon
but it should be pokémon
this is why I'm trying to find a way to convert é in the string to é but couldn't find any solution for that
- My meta tag is utf-8
- Tried normalizer
I'm receiving string from the back-end which is pokémon
but it should be pokémon
this is why I'm trying to find a way to convert é in the string to é but couldn't find any solution for that
You could just use the browsers built in DOM parser. Basically set the innerHTML
of a DOM element, and then read with the innerText
. Your then free to use this string inside your React control.
eg.
const d = document.createElement('div');
d.innerHTML = 'pokémon';
console.log(d.innerText);
To make the above code more re-usable you could do ->
const normalizeText = (() => {
const d = document.createElement('div');
return t => {
d.innerHTML = t;
return d.innerText;
}
})();
console.log(normalizeText('pokémon'));