I have strange question. How Can I change or set a sql char set in wordpress. In wp_config.php I have:

define('DB_CHARSET', 'utf8');
define('DB_COLLATE', 'utf8');

In my plugin I have this:

global $wpdb, $charset_collate;
require_once ABSPATH . 'wp-admin/includes/upgrade.php';

if ($wpdb->get_var("SHOW TABLES LIKE '" . $ow_odczyty . "'") != $ow_odczyty) {
        $query_one = "CREATE TABLE " . $ow_odczyty . " (
                id mediumint(9) NOT NULL AUTO_INCREMENT,
                data datetime DEFAULT '0000-00-00' NOT NULL,
                stan int NOT NULL,
                UNIQUE KEY id (id)
                ) $charset_collate;";

        add_option("ow_db_version", $ow_db_version);

What it's wrong. When this plugin create above script I have latin1_swedish_ci and I don't know why. Sorry for my English.

Best regards!

Browse other questions tagged or ask your own question.