The iconv code that I have, worked yesterday perfectly. Today it suddenly shows those question marks at the parts that should be translated(�).
setlocale(LC_ALL, 'nl_NL');
$title = str_replace(' & ', ' & ', $feed[$x]['title']);
$title = (iconv('UTF-8', 'ISO-8859-1//TRANSLIT//IGNORE', $title));
$link = $feed[$x]['link'];
$description = $feed[$x]['desc'];
$description = (iconv('UTF-8', 'ISO-8859-1//TRANSLIT//IGNORE', $description));
$datedag = date('d', strtotime($feed[$x]['date']));
$datemaand = date('F', strtotime($feed[$x]['date']));
$datejaar = date('Y', strtotime($feed[$x]['date']));
echo '<div style="border:1px solid black;background-color:#d90000;"><p><strong><a href="'.$link.'" title="'.$title.'" target="_blank">'.$title.'</a></strong><br />';
echo '<small><em>Geplaatst op '.$datedag.' '.$datemaand.', '.$datejaar.'</em></small></p>';
echo '<p>'.$description.'</p></div><br />';
Now, I didnt add the setlocale until the question marks showed up, but it had no succes.
Question: What am I doing wrong?
This worked for me
setlocale(LC_ALL, 'en_US.UTF-8');
although my language was Czech. Credit to Stone
It happened to me that the encoding was wrong since I updated PHP to 5.6. This version sets the default charset to UTF-8 and transports this via the HTTP-Header, even though you set your charset to ISO-8859-1 in your HTML meta-tag.
Consider using UTF-8 at all or overrule the default charset by including the following line at the beginning of your script:
ini_set('default_charset', '');
You can also change the default charset in your php.ini
as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With