加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 表已经是utf8字符集,仍然在某些字符中出现问号

发布时间:2020-12-13 22:50:50 所属栏目:PHP教程 来源:网络整理
导读:我正在尝试将我的编码更改为utf-8,下面是我到目前为止所做的. 表Charset 已安装mbstring extension=php_mbstring.dll 在php.ini中配置的mbstring mbstring.language = Neutralmbstring.internal_encoding = UTF-8mbstring.encoding_translation = On /*updat
我正在尝试将我的编码更改为utf-8,下面是我到目前为止所做的.

表Charset

已安装mbstring

extension=php_mbstring.dll

在php.ini中配置的mbstring

mbstring.language = Neutral
mbstring.internal_encoding = UTF-8
mbstring.encoding_translation = On /*updated it to mbstring.encoding_translation = 0*/
mbstring.http_input = auto         /*updated it to mbstring.http_input = pass*/
mbstring.http_output = UTF-8       /*updated it to mbstring.http_output = pass*/
mbstring.detect_order = auto  
mbstring.substitute_character
default_charset = UTF-8
mbstring.func_overload = 7

header('Content-type: text/html; charset=UTF-8');

HTML元标记

<meta http-equiv="Content-type" value="text/html; charset=UTF-8" />

HTML代码

<label for="article_body_pun">Article (Foreign): </label>
<textarea cols="100" rows="10" name="article_body_pun"></textarea><br />

PHP

$article_body_pun   = $_REQUEST['article_body_pun'];

SQL

$insert_article = "INSERT INTO articles(article_body_pun) 
                      VALUES ('{$article_body_pun}'')";

PHP要插入

$article_query = mysqli_query($connectDB,$insert_article);

应存储的数据 – >汉语

存储原始数据

?|?±?‰?¨?ˉ?

添加mysqli_set_charset($connectDB,“utf8”);正如@Pekka?所建议的那样,输出成为(以下评论)

?±èˉ

经过一些故障排除后,数据部分正确存储

??语

尝试通过mb_detect_encoding检查charset,并在结果上获取UTF-8.

并检查firefox中的charset.

这似乎是正确的,但仍然在某些角色上出现问号.任何进一步的建议,使这项工作?

解决方法

你快到了:确保mySQL连接也编码为UTF-8.

查看UTF-8 all the way through了解详情.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读