Hey everybody, I am posting here just in case anyone out there is having the same problem as I was.

I have two websites and they are hosted on two different servers. servers ONE I have a dedicated server with Linux (LAMP) and another website on server TWO with shared hosting.

everything works fine on server ONE but on server TWO i see weird characters every time data in inserted into my database table.

after a while of figuring out what the problem was, this is how i was able to resolve it.

  1. Make sure that you have get_magic_quotes_gpc enabled.
  2. There are many ways you can check if you have magic quotes enabled. You can read more about it here:
    hthttps://www.php.net/manual/en/function.get-magic-quotes-gpc.php#97783tps://www.php.net/manual/en/function.get-magic-quotes-gpc.php#97783
  3. Be sure that you are using htmlentities() function when inserting or displaying the data from the database. Do not use htmlspecialchars()

This will give you a roadmap on how to troubleshoot and fix some issues I got with accents in Spanish characters, for example, boy you say nino in Spanish, but you spell it like: niño and sometimes weird characters would come out.

here is another example

¿Cuál es su canción favorita? would come out as: ¿Cuál es su canción favorita? - To fix this use htmlentities()

Hope that helps.