accent problem in the bank

0

Friends, I'm having trouble writing with accent on the database as soon as I changed the version to PHP 5.6

I know you have a lot of questions on this subject, but I have tested several of them and it does not work at all, recreate the entire database, tables, everything from scratch and it does not work.

I'm using UTF8. Any recommendations for solving the problem?

Att

    
asked by anonymous 28.06.2017 / 04:15

2 answers

1

You should configure the encoding in PHP, just insert this line:

ini_set('default_charset', 'utf-8');

Also, at the time you connect to the database, using the example PDO:

$pdocon->exec("set names utf8");

For MSQLI:

$con = mysqli_connect($DB_SERVER, $DB_USER_READER, $DB_PASS_READER, $DB_NAME, $DB_PORT);

mysqli_set_charset($con, 'utf8');
    
28.06.2017 / 04:22
0

I've tried ini_set ('default_charset', 'utf-8'); it's nothing.

I also tried the following way and it did not work.

mysqli_query ($ connection, "SET NAMES 'utf8'"); mysqli_query ($ connection, 'SET character_set_connection = utf8'); mysqli_query ($ connection, 'SET character_set_client = utf8'); mysqli_query ($ connection, 'SET character_set_results = utf8');

The problem is only when you record in the BD, to display in the browser the accent loads normal.

When I used version 5.4 I did not have this problem, it was just migrating that the nightmare started.

    
28.06.2017 / 05:27