Charset issue from local to remote server
<p>I have a problem of charset.<br>
On localhost everything works fine, but now on remote server I see strange characters replacing others like à or è. I have read it's a charset issue and I think the problem can be my php.ini (I can't edit it).<br>
To solve it I've tried many things:<br>
I've set </p>

<pre><code>&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
</code></pre>

<p>on html,<br></p>

<pre><code>ini_set('default_charset', 'UTF-8');
</code></pre>

<p>on php,<br></p>

<pre><code>AddDefaultCharset utf-8 
</code></pre>

<p>on my .htaccess file,<br>
if I use utf8_encode on strings letters are replaced by ã or similar, if I leave it without doing anything letters are �<br>
There is another way to solve this problem that I have not found yet?</p>

<p>Sorry, I forgot to say it: strings are retrieved from another site by a file_get_contents (I'm using a Yandex API)</p>

<p>Here's some code:</p>

<pre><code>$yandex = 'https://dictionary.yandex.net/api/v1/dicservice.json/lookup?key=my_api_key&amp;lang=it-it&amp;text=attualità';

// get json from this page
$object = json_decode(file_get_contents($yandex));
$syns_array = array();
$type = '';
// if the word exists
if (!empty($object-&gt;def) &amp;&amp; $object-&gt;def != FALSE &amp;&amp; $object-&gt;def != NULL) 
{
    $type = $object-&gt;def[0]-&gt;tr[0]-&gt;pos;
    $rows = $object-&gt;def[0]-&gt;tr;
    // if there're synonyms
    if (!empty($rows) &amp;&amp; $rows != FALSE &amp;&amp; $rows != NULL) 
    {
        foreach ($rows as $row) 
        {
            array_push($syns_array, $row-&gt;text);
            // if there're more rows with syns
            if (!empty($row-&gt;syn) &amp;&amp; $row-&gt;syn !== FALSE &amp;&amp; $row-&gt;syn !== NULL) 
            {
                foreach ($row-&gt;syn as $syns_obj) 
                {
                    array_push($syns_array, $syns_obj-&gt;text);
                }
            }
        }
    }
}

// I echo my synonyms from the array
foreach($syns_array as $syn) {
    echo $syn;
}
</code></pre>