简体   繁体   中英

UTF-8 Encoding still wrong output

I have an encoding problem.

The table uses utf8_general_ci , the php header header("Content-Type: text/html; charset=utf-8"); and in the html the meta tag <meta charset="utf-8"> is set. BOM is set right. The german chars are displayed right in phpmyadmin.

But when I output it the encoding results: Sask

Any other idea what I can do?

This solves the problem

mysqli_query($link, "SET NAMES 'utf8'"); 
mysqli_query($link, "SET CHARACTER SET 'utf8'"); 
$db = mysqli_connect(DB_HOST, DB_USER, DB_PASS);
mysqli_set_charset($db, 'utf8'); // ← SOLUTION
mysqli_select_db($db, DB_NAME);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM