title: How can I split a string with accents in PHP?
body: <p>I would like to split hurgarian strings which have accents.
  Now I use this code:</p>
  
  <pre><code>if(strlen($row['title'])&lt;=20)
      {
          echo $row['title'];
      }
      else
      {
          echo substr($row['title'], 0, 17)." ...";
      }
  </code></pre>
  
  <p>I store these datas with latin2_hungarian_ci coding in the database and I use charset in php files. Both in PHP and HTML part:</p>
  
  <pre><code>header('Content-Type: text/html; charset=utf-8');
  
  &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
  </code></pre>
  
  <p>But with this way if the last character is a non english character (é,á,ö,ü,ó,ő,ú,ű,í) it isn't appears well. Against this character appears a � simbol.
  If I don't use substr just write the whole tite out everíthing works good.</p>
  
  <p>Now for example:
  A végzet erekly� ... or Északi széless� ...</p>
  
  <p>I can't understand this substr, because in my examples from one of them write 15 characters and that simbol, from the other one 16 characters and that simbol.</p>
  
  <p>How can I write out the first x characters from all of them?</p>