PHP `iconv` not working inside a WordPress site

I’m using the PHP iconv function to convert accented characters to their non-accented correspondents. For example, “ç” becomes “c”, “é” becomes “e” and so on…

For example, this code converts the word “ação” to “acao”:

<?php
$filename = “ação”;
$filename = iconv( ‘UTF-8’, ‘ASCII//TRANSLIT’, $filename); // convert latin characters
echo $filename; // shows “acao”

Check the code above here: https://ideone.com/tv5C03

However, running the same function inside my WordPress site, it shows:

a??o

How to fix this?

Read more here:: PHP `iconv` not working inside a WordPress site

Leave a Reply

Your email address will not be published. Required fields are marked *