Solved

Restricting Turkish Characters in Forms

Posted on 2006-11-07
2
404 Views
Last Modified: 2010-05-18
I have my Javascript to retrict special characters & Turkish characters.  When I save my file using Dreamweaver the Ğğ become Gg and the Şş become Ss which then sees the normal letters like GgSs as special characters.  How do I restrict the Turkish characters from my form?

var etcVal   = ' ~`!@#$%%^&*()-_=+\|[{]};:\'\",<.>/?&#286;&#287;Üü&#350;&#351;Çç';

function Specialcheck(value) {    
   var blankCount=0;
   var Speccount=0;
         
   for ( var i = 0 ; i < value.length ; i++ ){
      if ( value.substring( i, i+1 ) == " "  ) {        
         blankCount = blankCount + 1;  
         
      }
         for(j=0;j<etcVal.length;j++){
           if(value.substring( i, i+1 )  == etcVal.charAt(j)) {
               Speccount = Speccount + 1;
           }            
          }
   }    
   
      if(blankCount > 0 || Speccount > 0){
         return true;        
      }else{
         return false;    
      }
}

Thanks.
0
Comment
Question by:scgproductions
2 Comments
 
LVL 30

Accepted Solution

by:
callrs earned 500 total points
ID: 17892862
http://www.kadifeli.com/fedon/utf.htm  Unicode Characters and HTML Numeric Character References

Try 4-digit hexidecimal unicode values, as in this demo:

<script type="text/javascript">
var etcVal   = ' ~`!@#$%%^&*()-_=+\|[{]};:\'\",<.>/?\u011e\u011fÜü\u015f\u0160Çç';
document.write(etcVal+"<Br>");
function Specialcheck(value) {    
   var blankCount=0;
   var Speccount=0;
         
   for ( var i = 0 ; i < value.length ; i++ ){
      if ( value.substring( i, i+1 ) == " "  ) {        
         blankCount = blankCount + 1;  
         
      }
         for(j=0;j<etcVal.length;j++){
           if(value.substring( i, i+1 )  == etcVal.charAt(j)) {
               Speccount = Speccount + 1;
           }            
          }
   }    
   
      if(blankCount > 0 || Speccount > 0){
         return true;        
      }else{
         return false;    
      }
}

document.write("GgSs: "+Specialcheck("GgSs")+"<br>")
</script>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now