UTF-8 character set. Version: 1.0 Author: g30rg3_x Author URI: http://g30rg3x.com/ */ /* Copyright 2007 g30rg3_x (email : g30rg3x@gmail.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ // Dont access directly if( !defined( 'ABSPATH' ) ) die(); function UTF8_DB_Converter_menu_add() { if ( function_exists( 'add_submenu_page' ) ) add_submenu_page( 'plugins.php', 'UTF-8 DB Converter', 'UTF-8 DB Converter', 'level_10', 'utf8-db-converter', 'UTF8_DB_Converter_menu' ); } function UTF8_DB_Converter_menu() { $version = false; $success = false; if ( isset($_POST['submit']) ) { if ( function_exists('current_user_can') && !current_user_can('level_10') ) die('Only the blog owner has the access capabilities to this resource.'); if ( preg_match( '/Final/', $_POST['submit'] ) ) $success = UTF8_DB_Converter_DoIt(); else $version = true; } if ( preg_match( '/\\A(?:2\\.(1|2)\\.*.*)\\z/', get_bloginfo( 'version' ) ) ) $version = true; ?>

The database has been succesfully converted to UTF-8. View site »

UTF-8 DB Converter

WARNING
DATA MAY BE LOST VERSION NOT SUPPORTED

Before proceed with the final step please make a complete backup of your database.
Also is very recommendable that you close the public access of your WordPress based blog/website.

The next procedure may take some several time, so do not close your navigator or your internet connection during the execution of this plugin.

Proceed with the final step. This plugin has been developed and successfully tested under WordPress 2.2.x and WordPress 2.1.x
We cannot assure that it will work in any others minors or majors releases.
If you still want to use it after this warning proceed with the next and final step.

Also this warning may show if you change the version value "wp_version" inside the file "/wp-includes/version.php", so if you have changed this value and you know that you have supported version of WordPress...
Ignore this warning and continue to the next and final step.

categories CONVERT TO CHARACTER SET binary", $link_id ); mysql_query( "ALTER TABLE $wpdb->comments CONVERT TO CHARACTER SET binary", $link_id ); mysql_query( "ALTER TABLE $wpdb->link2cat CONVERT TO CHARACTER SET binary", $link_id ); mysql_query( "ALTER TABLE $wpdb->links CONVERT TO CHARACTER SET binary", $link_id ); mysql_query( "ALTER TABLE $wpdb->options CONVERT TO CHARACTER SET binary", $link_id ); mysql_query( "ALTER TABLE $wpdb->post2cat CONVERT TO CHARACTER SET binary", $link_id ); mysql_query( "ALTER TABLE $wpdb->postmeta CONVERT TO CHARACTER SET binary", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts CONVERT TO CHARACTER SET binary", $link_id ); mysql_query( "ALTER TABLE $wpdb->usermeta CONVERT TO CHARACTER SET binary", $link_id ); mysql_query( "ALTER TABLE $wpdb->users CONVERT TO CHARACTER SET binary", $link_id ); // Change database and tables to UTF-8 Character set. mysql_query( "ALTER DATABASE " . DB_NAME . " CHARACTER SET utf8", $link_id ); mysql_query( "ALTER TABLE $wpdb->categories CONVERT TO CHARACTER SET utf8", $link_id ); mysql_query( "ALTER TABLE $wpdb->comments CONVERT TO CHARACTER SET utf8", $link_id ); mysql_query( "ALTER TABLE $wpdb->link2cat CONVERT TO CHARACTER SET utf8", $link_id ); mysql_query( "ALTER TABLE $wpdb->links CONVERT TO CHARACTER SET utf8", $link_id ); mysql_query( "ALTER TABLE $wpdb->options CONVERT TO CHARACTER SET utf8", $link_id ); mysql_query( "ALTER TABLE $wpdb->post2cat CONVERT TO CHARACTER SET utf8", $link_id ); mysql_query( "ALTER TABLE $wpdb->postmeta CONVERT TO CHARACTER SET utf8", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts CONVERT TO CHARACTER SET utf8", $link_id ); mysql_query( "ALTER TABLE $wpdb->usermeta CONVERT TO CHARACTER SET utf8", $link_id ); mysql_query( "ALTER TABLE $wpdb->users CONVERT TO CHARACTER SET utf8", $link_id ); // Return all binary text/string fields changed previously to their original representations. mysql_query( "ALTER TABLE $wpdb->categories MODIFY cat_name varchar(55) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->categories MODIFY category_nicename varchar(200) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->categories MODIFY category_description longtext NOT NULL", $link_id ); mysql_query( "ALTER TABLE $wpdb->comments MODIFY comment_author tinytext NOT NULL", $link_id ); mysql_query( "ALTER TABLE $wpdb->comments MODIFY comment_author_email varchar(100) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->comments MODIFY comment_author_url varchar(200) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->comments MODIFY comment_author_IP varchar(100) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->comments MODIFY comment_content text NOT NULL", $link_id ); mysql_query( "ALTER TABLE $wpdb->comments MODIFY comment_approved enum('0','1','spam') CHARACTER SET utf8 NOT NULL DEFAULT '1'", $link_id ); mysql_query( "ALTER TABLE $wpdb->comments MODIFY comment_agent varchar(255) NOT NULL DEFAULT ''"); mysql_query( "ALTER TABLE $wpdb->comments MODIFY comment_type varchar(20) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->links MODIFY link_url varchar(255) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->links MODIFY link_name varchar(255) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->links MODIFY link_image varchar(255) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->links MODIFY link_target varchar(25) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->links MODIFY link_description varchar(255) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->links MODIFY link_visible enum('Y','N') CHARACTER SET utf8 NOT NULL DEFAULT 'Y'", $link_id ); mysql_query( "ALTER TABLE $wpdb->links MODIFY link_rel varchar(255) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->links MODIFY link_notes mediumtext NOT NULL", $link_id ); mysql_query( "ALTER TABLE $wpdb->links MODIFY link_rss varchar(255) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->options MODIFY option_name varchar(64) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->options MODIFY option_can_override enum('Y','N') CHARACTER SET utf8 NOT NULL DEFAULT 'Y'", $link_id ); mysql_query( "ALTER TABLE $wpdb->options MODIFY option_value longtext NOT NULL", $link_id ); mysql_query( "ALTER TABLE $wpdb->options MODIFY option_description tinytext NOT NULL", $link_id ); mysql_query( "ALTER TABLE $wpdb->options MODIFY autoload enum('yes','no') CHARACTER SET utf8 NOT NULL DEFAULT 'yes'", $link_id ); mysql_query( "ALTER TABLE $wpdb->postmeta MODIFY meta_key varchar(255) DEFAULT NULL", $link_id ); mysql_query( "ALTER TABLE $wpdb->postmeta MODIFY meta_value longtext", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts MODIFY post_content longtext NOT NULL", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts MODIFY post_title text NOT NULL", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts MODIFY post_excerpt text NOT NULL", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts MODIFY post_status enum('publish','draft','private','static','object','attachment','inherit','future') CHARACTER SET utf8 NOT NULL DEFAULT 'publish'", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts MODIFY comment_status enum('open','closed','registered_only') CHARACTER SET utf8 NOT NULL DEFAULT 'open'", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts MODIFY ping_status enum('open','closed') CHARACTER SET utf8 NOT NULL DEFAULT 'open'", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts MODIFY post_password varchar(20) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts MODIFY post_name varchar(200) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts MODIFY to_ping text NOT NULL", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts MODIFY pinged text NOT NULL", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts MODIFY post_content_filtered text NOT NULL", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts MODIFY guid varchar(255) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts MODIFY post_type varchar(20) NOT NULL DEFAULT 'post'", $link_id ); mysql_query( "ALTER TABLE $wpdb->posts MODIFY post_mime_type varchar(100) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->usermeta MODIFY meta_key varchar(255) DEFAULT NULL", $link_id ); mysql_query( "ALTER TABLE $wpdb->usermeta MODIFY meta_value longtext", $link_id ); mysql_query( "ALTER TABLE $wpdb->users MODIFY user_login varchar(60) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->users MODIFY user_pass varchar(64) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->users MODIFY user_nicename varchar(50) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->users MODIFY user_email varchar(100) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->users MODIFY user_url varchar(100) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->users MODIFY user_activation_key varchar(60) NOT NULL DEFAULT ''", $link_id ); mysql_query( "ALTER TABLE $wpdb->users MODIFY display_name varchar(250) NOT NULL DEFAULT ''", $link_id ); // Optimize tables and finally close the mysql link mysql_query( "OPTIMIZE TABLE $wpdb->categories , $wpdb->comments , $wpdb->link2cat , $wpdb->links , $wpdb->options , $wpdb->post2cat , $wpdb->postmeta , $wpdb->posts , $wpdb->usermeta , $wpdb->users", $link_id ); mysql_close( $link_id ); return true; } add_action( 'admin_menu', 'UTF8_DB_Converter_menu_add' ); ?>