I found the solution for the issue. It seems that thre is a regex issue with the "m=new RegExp(["[À-ß][€-¿]","[à -ï][€...". I played around with the regex and able to get it to work. For now im using m = new RegExp(["[Àß-][¿-]", "[àï-][¿-]{2}", "[ð÷-][¿-]{2}"].join("|"), "g"), . This might not be the intended regex. But far now it seems to work.