質問

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.

役に立ちましたか?

解決

Encode your javascript file into utf-8 and update your meta tag to:

<meta http-equiv="content-type" content="text/html;charset=utf-8" />
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top