dgnzcn Posted August 17, 2013 Share Posted August 17, 2013 (edited) 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> Edited August 17, 2013 by dgnzcn Quote Link to comment https://forums.phpfreaks.com/topic/281274-special-characters-converting-problem/ Share on other sites More sharing options...
jazzman1 Posted August 17, 2013 Share Posted August 17, 2013 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" /> Quote Link to comment https://forums.phpfreaks.com/topic/281274-special-characters-converting-problem/#findComment-1445489 Share on other sites More sharing options...
dgnzcn Posted August 17, 2013 Author Share Posted August 17, 2013 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" /> Quote Link to comment https://forums.phpfreaks.com/topic/281274-special-characters-converting-problem/#findComment-1445491 Share on other sites More sharing options...
jazzman1 Posted August 17, 2013 Share Posted August 17, 2013 (edited) How do you get these names from a database or just from a regular file? Edited August 17, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/281274-special-characters-converting-problem/#findComment-1445493 Share on other sites More sharing options...
Irate Posted August 17, 2013 Share Posted August 17, 2013 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. Quote Link to comment https://forums.phpfreaks.com/topic/281274-special-characters-converting-problem/#findComment-1445513 Share on other sites More sharing options...
dgnzcn Posted August 17, 2013 Author Share Posted August 17, 2013 How do you get these names from a database or just from a regular file? it was a simply textfield. not coming from database or a regular file. Quote Link to comment https://forums.phpfreaks.com/topic/281274-special-characters-converting-problem/#findComment-1445545 Share on other sites More sharing options...
dgnzcn Posted August 17, 2013 Author Share Posted August 17, 2013 is there any coding issue in my script? Quote Link to comment https://forums.phpfreaks.com/topic/281274-special-characters-converting-problem/#findComment-1445546 Share on other sites More sharing options...
jazzman1 Posted August 18, 2013 Share Posted August 18, 2013 Can you post here some piece of text? Quote Link to comment https://forums.phpfreaks.com/topic/281274-special-characters-converting-problem/#findComment-1445623 Share on other sites More sharing options...
dgnzcn Posted August 18, 2013 Author Share Posted August 18, 2013 sample text: DOĞAN ÖZÇİNE Quote Link to comment https://forums.phpfreaks.com/topic/281274-special-characters-converting-problem/#findComment-1445675 Share on other sites More sharing options...
jazzman1 Posted August 19, 2013 Share Posted August 19, 2013 Save the file which contains this text field as UTF8 file encoding without BOM, because I don't see anything wrong with this name. Quote Link to comment https://forums.phpfreaks.com/topic/281274-special-characters-converting-problem/#findComment-1445719 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.