我有一个使用MySQL数据库的Wordpress网站。我想在我的数据库中放一个希腊字(Ἀπὸ)。 (请注意,它在Stack Overflow接口中呈现的效果很好。)如果我这样做,它会进入表格并且在Sequel Pro中呈现得很好。然而,当我使用一些PHP将其从表格中读出并将其添加到我的Wordpress网站上的页面时,它会呈现???而不是Ἀπὸ。但是,如果我直接将该词添加到Wordpress界面中的页面,则会在界面和呈现的页面上显示希腊字符。我看看显示的页面?我看到下面这行:Wrangling希腊字符
<meta charset='utf-8'>
我相信应该只需要渲染这些希腊字符。我错过了什么?
编辑
因为有人问它:
CREATE TABLE `scripture` (
`id` int(6) unsigned NOT NULL AUTO_INCREMENT,
`translation` varchar(4) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`content` varchar(1200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`book` varchar(20) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`chapter` int(3) NOT NULL,
`verse` varchar(7) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`first_verse` int(3) DEFAULT NULL,
`topic` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`related1` int(6) DEFAULT NULL,
`related2` int(6) DEFAULT NULL,
`related3` int(6) DEFAULT NULL,
`related4` int(6) DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `book_chapter_verse_translation` (`book`,`chapter`,`verse`,`translation`),
KEY `translation_book_chapter_first_verse` (`translation`,`book`,`chapter`,`first_verse`)
) ENGINE=InnoDB AUTO_INCREMENT=1129 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
character_set_client utf8
character_set_connection utf8
character_set_database utf8
character_set_filesystem binary
character_set_results utf8
character_set_server latin1
character_set_system utf8
character_sets_dir /rdsdbbin/mysel-5.6.23.R1/share/charsets/
的wp-config.php文件有以下几点:
/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');
/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');
我曾尝试评论出来,我曾尝试使DB_COLLATE = utf8_unicode_ci
第二个编辑
解决的办法是提前查询添加以下PHP代码:
$mysqli->set_charset("utf8");
什么是数据库和Wordpress表的数据库整理? http://stackoverflow.com/questions/341273/what-does-character-set-and-collation-mean-exactly – markratledge
所以,你的意思是“字符”,而不是“字体” – Strawberry
数据库的字符集是UTF- 8 Unicode和排序规则是utf8_unicode_ci。 –