title: String of Chinese characters longer that MySQL field
body: <p>I am developing a web app using MySQL and PHP. Some of the users will be Chinese so that I need to test my program with Chinese characters. As Chinese characters are longer that the usual ASCII characters, it happens that the MySQL field may be shorter than the string with Chinese characters.</p>
  
  <p>I tried to limit the lenth in the input two times smaller than the MySQL field as in the example below:</p>
  
  <pre><code>&lt;input name='field_name' maxlength='5'&gt; in HTML
  field_name VARCHAR(10) in MySQL (all my field are encoded with utf8_unicode_ci)
  </code></pre>
  
  <p>Nevertheless, the string '好好好好好‘ that have 5 characters would be truncated.</p>
  
  <p>That is an important issue because truncated strings ends with the symbol "�" and jQuery ajax calls (json) reject an error.</p>
  
  <p>That is why I would like to know how to secure on client and server sides these inputs so that the integrity of data would not be impacted in any situation (or at least be displayed even it is truncated).</p>
  
  <p>Thanks!</p>