I have this code:
var text = "ß042´ßzpüwhü90hu54/()=?*/()=?*";
var symboles = "!§$%&/()=?*<;:-<,.-#+|~}][{@€";
var symbolsContained = "", found = false;
for (var i = 0; i < symboles.length; i++) {
if (text.indexOf(symboles[i]) != -1) {
found = true;
symbolsContained += symboles[i];
}
}
console.log(symbolsContained, symbolsContained.length);
Unfortunately it is not working properly:
- symboles[1] finds a character that is not in the list ("A" with a ":" above it)
- The "€" is not processed properly
Using substr() doesn't fix this. I guess it is a subject of character encoding but this is still a mystery for me. Any hint how this can be fixed?