简体   繁体   English

UTF-8编码仍然输出错误

[英]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"); 该表使用utf8_general_ci ,php标题header("Content-Type: text/html; charset=utf-8"); and in the html the meta tag <meta charset="utf-8"> is set. 并在html中设置元标记<meta charset="utf-8"> BOM is set right. BOM设置正确。 The german chars are displayed right in phpmyadmin. 德语字符显示在phpmyadmin中。

But when I output it the encoding results: Sask 但是当我输出编码结果时: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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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