PHP json_encode not working with apostrophe
<p>I try to json encode an array, It always works unless there is a string ANYWHERE in the array that contains this exact apostrophe "<code>’</code>"</p>

<p>I tried to string replace it but it doesn't work...</p>

<pre><code>        $thistrack = str_replace('’','',$thistrack);
        $thistrack = str_replace('\u2019','',$thistrack);
        $thistrack = str_replace('\0092','',$thistrack);
        $thistrack = str_replace('\\\\u0027','',$thistrack);
</code></pre>

<p>In this case. $thistrack contains the following:
<code>var_dump($thistrack);</code>
<a href="https://i.stack.imgur.com/jTMRC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jTMRC.png" alt="Var_Dump"></a>
<code></code></p>

<p>In the end, this is what i'd like to achieve.</p>

<pre><code>$savestuff = file_put_contents($savepath.'history.rhr', json_encode($completehistory));
</code></pre>

<p>But the file is empty, this ALWAYS happens when there is a <code>’</code> somewhere in the array...</p>