title: codeigniter insert : special characters trims my string values
body: <p>I have a problem executing insert commands that are loaded from a text file. I use codeIgniter "file" helper to load an sql line then I perform a simple db->query(<code>content of my file</code>). The problem is when the sql is loaded from a file the special character trims the rest of the string.</p>
  
  <p>Here is an example that works</p>
  
  <pre><code>INSERT INTO test(test) VALUES("&lt;p&gt;There is &lt;strong&gt;no special character&lt;/strong&gt; in this string&lt;/p&gt;");
  </code></pre>
  
  <p>Example that <strong>will not work</strong></p>
  
  <pre><code>INSERT INTO test(test) VALUES("&lt;p&gt;this character &lt;em&gt;é&lt;/em&gt; is a &lt;strong&gt;special character&lt;/strong&gt;&lt;/p&gt;");
  </code></pre>
  
  <p>In the second example, only <code>"&lt;p&gt; this character &lt;em&gt;"</code> will be saved. This is weird because if I execute the same line in phpMyAdmin it works fine. </p>
  
  <p>Anyone knows why this happens? or what I do wrong?</p>
  
  <p>Thanks</p>
  
  <hr>
  
  <p>Here is a simple "step to reproduce". </p>
  
  <p>Simple table :</p>
  
  <pre><code>CREATE TABLE `test` (
  `test` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
  ) ENGINE = InnoDB;
  </code></pre>
  
  <p>A file "application/view/text.txt" that contains :</p>
  
  <pre><code>INSERT INTO test(test) VALUES("&lt;p&gt;this character &lt;em&gt;é&lt;/em&gt; is a &lt;strong&gt;special character&lt;/strong&gt;&lt;/p&gt;");
  </code></pre>
  
  <p>The code I use to perform the insert</p>
  
  <pre><code>$this-&gt;load-&gt;helper('file');
  $loaded_sql = read_file(BASEPATH . "../application/views/test.txt");
  $this-&gt;db-&gt;query($loaded_sql);
  </code></pre>
  
  <p>My database config</p>
  
  <pre><code>$db['default']['char_set'] = 'utf8';
  $db['default']['dbcollat'] = 'utf8_general_ci';
  </code></pre>
  
  <p>CI Config</p>
  
  <pre><code>$config['charset'] = 'UTF-8';
  </code></pre>