Solved

Restricting Turkish Characters in Forms

Posted on 2006-11-07
2
403 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
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 …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

747 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

9 Experts available now in Live!

Get 1:1 Help Now