本文介绍了不同MySQL数据库中多个表之间的阿拉伯数据传输返回?????????作为新价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用PHP将某些数据从database1.table1letters字段插入到database2.table2new_letters字段,但是所有值都更改为问号,例如new_lettersnew_letters字段中. letters的结构为(Type:longtext,整理:utf8_general_ci),而new_letters的结构为(Type:mediumtext,整理:utf8_unicode_ci).另外,我需要提及的是,即使将两个排序规则都更改为utf8_unicode_ci或utf8_general_ci也无法解决问题.你能让我知道是什么问题吗?

I inserted some data from a letters field in database1.table1 to new_letters field in database2.table2 by using PHP, but all the values are changed to question marks like ????? ?????? ????? ??????? ?? ??? ???? ????? ????? in the new_letters field. Structure of the letters is (Type:longtext, Collation: utf8_general_ci), and the structure of the new_letters is (Type:mediumtext, Collation: utf8_unicode_ci). Also, I need to mention that even changing both collations to utf8_unicode_ci or utf8_general_ci did not solve the problem. Could you please let me know what is the problem?

推荐答案

您需要确保从连接到数据库再到表的整个链都是UTF8干净的.我对此处的类似问题有详细的答案

You need to make sure your entire chain from the connection, to the database, to the tables is all UTF8 clean. I have a detailed answer to a similar question here.

但是,在您的情况下,请检查实际的MySQL服务器my.cnf文件.下面将把整个链设置为UTF-8:

But in your case, check the actual MySQL server my.cnf file. The following would set the whole chain to UTF-8:

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
collation-server = utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-server = utf8

这篇关于不同MySQL数据库中多个表之间的阿拉伯数据传输返回?????????作为新价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 03:14