I have a Sheets that contains text as défi
(défi) or Österreich
(Östereeich).
I can decode the first by this script, on the other hand I am not able to do the second (I mean the code takes 3 bytes)
Thanks for any help!
function decode(txt){
var texte = []
for (i=0;i<txt.length;i++){
var n = txt.substring(i,i+1).charCodeAt()
if (n>127){
if ((n & 32) > 0){
//texte.push(decode_utf8(txt.substring(i,i+3))) ??
i+=2
}
else{
texte.push(decode_utf8(txt.substring(i,i+2)))
i++
}
}
else{
texte.push(txt.substring(i,i+1))
}
}
return (texte.join(''))
}
function decode_utf8(s) {
return decodeURIComponent(escape(s));
}