Aug 24

我感觉这样的东西还要弄不少。。。。

democracy 2.0.1 最新版,后台管理以及前台显示均为中文乱码。先查JS,PHP部分均未发现源头,最后拿PhpMyAdmin查看数据库也是乱码,发现 wp_democracyQ,wp_democracyA均为letin编码而非UTF8,手动改好后,页面显示正常。

反过来再查改源码,只要在插件创建表的时候强制为UT8即可,打开 democracy.php ,第 149 行起:



CREATE TABLE {$table_prefix}democracyQ (
 id int(10) unsigned NOT NULL auto_increment,
 question text NOT NULL,
 added int(10) unsigned NOT NULL default '0',
 allowusers tinyint(1) unsigned NOT NULL default '0',
 current tinyint(1) unsigned NOT NULL default '0',
 active tinyint(1) unsigned NOT NULL default '0',
 multiple tinyint(1) unsigned NOT NULL default '0',
 PRIMARY KEY  (id),
 KEY current (current)
 ) TYPE=MyISAM CHARACTER SET=utf8;

CREATE TABLE {$table_prefix}democracyA (
  aid int(10) unsigned NOT NULL auto_increment,
  qid int(10) unsigned NOT NULL default '0',
  answer text NOT NULL,
  votes mediumint(6) unsigned NOT NULL default '0',
  added_by tinyint(1) unsigned NOT NULL default '0',
  PRIMARY KEY  (aid),
  KEY qid (qid)
) TYPE=MyISAM CHARACTER SET=utf8;

注意添加了最后的 TYPE=MyISAM CHARACTER SET=utf8 这句。

嗯,偷懒的,这里有改好的文件:

点击显示引用框
引用本文,复制粘贴...