Show non ascii characters in text
by tim spear
HTML
Paste your text here:
<p>
<textarea id="input"></textarea>
</p>
<p>
Output here (showing codepoints >128):
<div id="output"> - </div>
</p>
Output with them removed:
<p>
<div id="output2"> - </div>
</p>
JavaScript
$("#input").on('input', function() {
input = $("#input").val()
ch = [...input]
out = ""
out2 =""
for (i = 1; i < ch.length; i++) {
no = ch[i].codePointAt(0)
out = out + ch[i];
out2 += ch[i];
if (no == 10)(out += "<br>")
if (no > 128) {
out += "[" + no + "]"
}
}
$("#output").html(out)
$("#output2").html(out2)
});