在Bluehost中部署Drupal不能正确显示中文的问题
问题:
在Bluehost中部署Drupal不能正确显示中文。
原因:
MySql的字符集编码设置不正确。
解决:
在手动安装Drupal之前,登录Bluehost的cPanel,在phpMyAdmin中选择创建的数据库xxx_drupal,在最下面的“整理/collation”中选择:utf8_general_ci,〔执行〕。
或者在SQL中执行:
注:如果已经使用fantastico安装好了,数据库的名字应该是:xxx_drpl1。并且,光改数据库的字符集没用,还需要改每个表的,SQL如下,可以省事一点:
ALTER TABLE `access` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `authmap` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `blocks` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `blocks_roles` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `boxes` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `cache` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `cache_filter` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `cache_menu` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `cache_page` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `comments` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `files` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `file_revisions` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `filters` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `filter_formats` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `flood` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `history` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `menu` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `node` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `node_access` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `node_comment_statistics` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `node_counter` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `node_revisions` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `node_type` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `permission` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `role` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sequences` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sessions` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `system` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `term_data` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `term_hierarchy` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `term_node` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `term_relation` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `term_synonym` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `url_alias` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `users` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `users_roles` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `variable` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `vocabulary` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `vocabulary_node_types` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `watchdog` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
呵呵,原来光做完这些功课还不行,得用CONVERT TO CHARACTER将原来的纪录转换成utf8才能正确显示,怎么没有ALTER DATABASE ... CONVERT TO CHARACTER ...呢?
ALTER TABLE `access` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `authmap` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `blocks` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `blocks_roles` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `boxes` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `cache` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `cache_filter` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `cache_menu` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `cache_page` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `comments` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `files` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `file_revisions` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `filters` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `filter_formats` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `flood` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `history` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `menu` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `node` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `node_access` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `node_comment_statistics` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `node_counter` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `node_revisions` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `node_type` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `permission` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `role` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sequences` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `sessions` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `system` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `term_data` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `term_hierarchy` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `term_node` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `term_relation` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `term_synonym` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `url_alias` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `users` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `users_roles` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `variable` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `vocabulary` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `vocabulary_node_types` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
ALTER TABLE `watchdog` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;
好啦,目前为止网站(www.qilv.org)算部署好了,更重要的工作在后面了,怎么把内容做好。
参考资源:
Drupal with Addon domain at BlueHost