title: Find non-ascii characters from a UTF-8 string
body: <p>I need to find the non-ASCII characters from a UTF-8 string.</p>
  
  <p>my understanding: 
  UTF-8 is a superset of character encoding in which 0-127 are ascii characters.
  So if in a UTF-8 string , a characters value is Not between 0-127, then it is not a ascii character , right? Please correct me if i'm wrong here.</p>
  
  <p>On the above understanding i have written following code in C :</p>
  
  <p>Note:
  I'm using the Ubuntu gcc compiler to run <strong>C</strong> code</p>
  
  <p>utf-string is <strong>x√ab c</strong></p>
  
  <pre><code>long i;
      char arr[] = "x√ab c";
      printf("length : %lu \n", sizeof(arr));
          for(i=0; i&lt;sizeof(arr); i++){
  
          char ch = arr[i];
          if (isascii(ch))
               printf("Ascii character %c\n", ch);
                else
               printf("Not ascii character %c\n", ch);
      }
  </code></pre>
  
  <p>Which prints the output like:</p>
  
  <pre><code>length : 9 
  Ascii character x
  Not ascii character 
  Not ascii character �
  Not ascii character �
  Ascii character a
  Ascii character b
  Ascii character  
  Ascii character c
  Ascii character 
  </code></pre>
  
  <p>To naked eye length of <strong>x√ab c</strong> seems to be 6, but in code it is coming as 9 ?
  Correct answer for the <strong>x√ab c</strong> is 1 ...i.e it has only 1 non-ascii character , but in above output it is coming as 3 (times Not ascii character).</p>
  
  <p>How can i find the non-ascii character from UTF-8 string, correctly.</p>
  
  <p>Please guide on the subject.</p>