Reputation: 14747
I am trying to replace all the non latin/turkish characters, but something is wrong and I can't find it.
For example:
var texto = '*istediğiniz*';
if (texto.match(/[^a-zA-Z0-9şŞıİçÇöÖüÜĞğ\- ]/g)){
//only letters, numbers and turkish letters are allowed
texto = texto.replace(/[^a-zA-Z0-9şŞıİçÇöÖüÜĞğ\- ]/g, '');
}
console.log(texto);
As a result, my word is output incorrectly: istediiniz
. The output should be istediğiniz
.
Upvotes: 5
Views: 7854
Reputation: 317
Encode your javascript file into utf-8
and update your meta tag to:
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
Upvotes: 3