André Ferraz
André Ferraz

Reputation: 1521

SQL UTF-8 encoding printing �

am working on SQL databases that will have content in different languages, Spanish, Portuguese, English, Chinese ... etc. I have some content already on the database in Spanish and I have already setup the collation settings to utf8_general_ci but for some reason it still print this symbol "�". I guess is a character that has not been encoded.

This is what I did for the HTML5 code. According to W3SCHOOLS the default character encoding in HTML-5 is UTF-8, so I tried with the charset and with out it.

<!DOCTYPE HTML>
<html lang="es">
   <head>
      <meta charset="UTF-8">
   </head>
   <body>
      <?php
          // PRINT'S CONTENT FROM DB
      ?>
   </body>
</html>

Below is my SQL database side.

ALTER TABLE `table` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

Is there anything I am missing or anything I haven't done?

Upvotes: 0

Views: 400

Answers (2)

Bassem
Bassem

Reputation: 107

use the function mysql_set_charset

Upvotes: 1

Manjunatha
Manjunatha

Reputation: 44

Please change the setting from the following folder php/mysql setup:

// ***notice "utf8", without dash, this is a mysql encoding***
mysql_set_charset('utf8');

Upvotes: 1

Related Questions