WordPress post enconding issue

I have a page originally encoded in iso-8859-1 which won’t display correctly once incorporated into a wordpress post. I was able to replicate the issue outside of wordpress, forcing the encoding of the page to be read as utf-8 instead. Here you can see what happens:

ISO-8859-1 page: http://www.maxballet.it/sito/orari.php

Read More

UTF-8: http://www.maxballet.it/sito/orari2.php

Unfortunately i’m unable to show the original post itself, but that’s exactly what happens.

So of course i understand that there’s some issue at some step of the whole pipeline from the browser to the database i’m pulling the data from (probably some non-utf8 characters inside the database itself). But since investigating into this issue has been really time consuming for me during the past few days, after a few tries i instead tried to force the wordpress page encoding to be read as iso-8859-1 (via the <meta> tag), in order to quick-fix it while investigating.

Unfortunately, even tough firefox could be able to detect the wordpress post’s page encoding as iso-8859-1, that didn’t work, and the post still displays as the faulty example above.

I’m investigating the pipeline encoding issue myself and i posted about that here already into another question, but at this point i really need to let this page run again.

I’m probably missing something about the wordpress platform, which i am definetly not familiar with. So any suggestion on how to fix this inside wordpress without having to fix the whole pipeline would be really appreciated.

Thanks in advance to everyone.

UPDATE 1: I forgot to mention that i’ve already tried to utf8_encode() any string coming from the database with no luck.

Related posts

Leave a Reply

2 comments

  1. That fixed the issue. Everything’s working flawless now. Thank you so much for that. If you wanna post that as the answer i’ll mark yours as the solution

    As per OP’s wish to close the question as per my original comment:

    Seeing your other question, you’re pulling this from a database.

    Try passing encoding to your DB connection right before your query.

    That sometimes fixes it.

    For example mysqli_set_charset($con, 'utf8'); or $con->set_charset("utf8");