Problem with php special characters

Asked

Viewed 2,742 times

2

I’m using php on the html page to validate a form. When the database retouches the text to the page php is not displaying the result with special characters. Where is the error?

Page:

 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

Table of the MYSQL database:

utf8_unicode_ci

Result of PHP:

echo "<ul>";  
  echo "<li>";
    echo "<a data-toggle='modal' href='{$link}'>" ;
      echo "{$titulo} </a>- {$descricao}";
  echo "</li>";
  echo "</ul>";
  • Try using "echo utf8_decode($variavel);"

  • @Williancoqueiro sees if this file is also saved in UTF-8!

  • @fleuquerlima tested the 2 and did not work. Thanks more for the help.

1 answer

2


Check your bank to see if you are recording the information correctly. If so, change this:

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

For that reason:

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

Your bank’s meeting should be latin1_swedish_ci, because it accepts accents, ç and all Latin characters.

Or try to:

 echo "utf8_decode({$titulo}) </a>- utf8_decode({$descricao})";
  • 1

    I used the meta with iso-8859-1 and it worked, as I prefer to utf8, I went back to him and changed the bank to latin1_swedish_ci and perfect. Thank you very much, without your help would beat me hours.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.