Rails: "Mysql2::Error: Incorrect string value:" when trying to save "params.inspect"
<p>I am trying to save to database the output of params (I am saving this: <code>params.inspect</code>) - here's an example of the string that's supposed to be saved:</p>

<pre><code>&gt; {\"utf8\"=&gt;\"✓\", \"_method\"=&gt;\"patch\", \"authenticity_token\"=&gt;\"fpQC8FY8+qztD41jjcFSJRars539KRshw/vczmmJd9Q=\",
&gt; \"car\"=&gt;{\"role_type\"=&gt;\"1\", \"admin_id\"=&gt;\"67\",
&gt; \"branch_id\"=&gt;\"1\", \"template_id\"=&gt;\"21\", \"cost\"=&gt;\"0.00\",
&gt; \"carrier_additional_cost\"=&gt;\"0.00\", ...
</code></pre>

<p>First, I tried to save the params like this:</p>

<pre><code>all_params      = params.except(:controller, :action).inspect
</code></pre>

<p>but it didn't work out. So:</p>

<pre><code>all_params      = params.except(:controller, :action).inspect.encode("iso-8859-1")
</code></pre>

<p>Also this:</p>

<pre><code>all_params      = params.except(:controller, :action).inspect.encode("iso-8859-1").force_encoding("utf-8")
</code></pre>

<p>returns the same error.</p>

<p>How to properly save the output from <code>params.inspect</code>?</p>

<p>The column where I try to save this data is <code>text</code>, not <code>string</code>. </p>

<p>Thank you</p>