Ran into this How to emulate mb_strlen in javascript with strings containing HTML
where the string was not a good match for earlier answers.
I got the expected length of 8 here:
const str = 'X "FUEL"'const div = document.createElement("div");div.innerHTML = strconsole.log(div.textContent.length)