UTF-8 Charset error when returning from database

Asked

Viewed 710 times

-2

My system has charset error, but it is only with the data returned from the database. My HTML charset is right, the one in the database is also right, and on php.ini is also right.

How do I solve the problem? The special characters are returning ?.

  • you are using PDO ?

  • Related: http://answall.com/questions/77491/inclu-charset-utf-8-na-conx%C3%A3o-mysqli/77494#77494

  • 1

    Not to say that the problem is only with mysql or mariadb, these tips should help you with php, html and the database: http://answall.com/a/43205/3635

1 answer

2


Set the desired charset at runtime.

If you are using PDO, do:

$pdo->exec('SET NAMES utf8');

In Mysqli:

mysqli_query($mysql, 'SET NAMES utf8')

Browser other questions tagged

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