Jump to content

special characters converting problem


dgnzcn

Recommended Posts

hi freinds,

 

i edit some following codes. it is copying from studentName textfield and writing to studentLink textfield, This ok but,

it can not converting in studentName special characters to studentLink textfield. How can it write to studentLink textfield without special characters ?

 

 

 

<script>
function sync()
{
  var n1 = document.getElementById('studentName');
  var n2 = document.getElementById('studentLink');
  n2.value = n1.value;
}
</script>
<script language="JavaScript">
function karaktercevir(text)
    {
      var yaz = new String();
      var chars = text.value.split("");
      for (i = 0; i < chars.length; i++) {
          chars[i]=chars[i].replace("Ç", "C");
          chars[i]=chars[i].replace("ç", "c");
          chars[i]=chars[i].replace("Ğ", "G");
          chars[i]=chars[i].replace("ğ", "g");
          chars[i]=chars[i].replace("İ", "I");
          chars[i]=chars[i].replace("ı", "i");
          chars[i]=chars[i].replace("Ö", "O");
          chars[i]=chars[i].replace("ö", "o");
          chars[i]=chars[i].replace("Ş", "S");
          chars[i]=chars[i].replace("ş", "s");
          chars[i]=chars[i].replace("Ü", "U");
          chars[i]=chars[i].replace("ü", "u");
          yaz += chars[i];
      }
      if (text.value != yaz) text.value = yaz;
    }
</script>  
Link to comment
https://forums.phpfreaks.com/topic/281274-special-characters-converting-problem/
Share on other sites

 

it can not converting in studentName special characters to studentLink textfield

 

Do you have a meta tag with charset utf8 on the top of the page, something like:

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

 

Do you have a meta tag with charset utf8 on the top of the page, something like:

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

hi

 why not converting?

 

yes it has <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Some browsers do not always correctly set the charset HTTP header, so I think you could try adding a header("Content-Type: text/html; charset=utf-8"); in your PHP file if you are using one.

 

Otherwise, try getting the Unicode-formatted character encodings for the characters you need.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.