Plugin Contributor
dudo
(@dudo)
Hi,
This is pretty strange because that string are store in a default WordpPress table.
I made a test (Screenshoot here https://ibb.co/r6QdVn7 ) and everything is fine indeed.
Are you sure your database is in UTF-8?
I have checked and found out that the table had been created as with latin1_swedish_ci encoding. So I have checked the plugin code and it looks like you aren’t explicitly setting the character encoding to be used. This is what is causing the issue to happen. The right way to create the table is to check user DB charset and then to explicitly force it for new tables. Otherwise, it will switch down to random values and eventually cause problems.
Here is a code snippet to help you :
if ($wpdb->has_cap('collation'))
{
if (!empty($wpdb->charset))
$charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
if (!empty($wpdb->collate))
$charset_collate .= " COLLATE $wpdb->collate";
}
$wpdb->query("CREATE TABLE IF NOT EXISTS {$wpdb->prefix}mytable (
id int(11) unsigned NOT NULL auto_increment,
optionvalue text,
PRIMARY KEY (id)
) $charset_collate;");
The query part is missing quotes (those get stripped off in this editor).
To fix the issue for existing installs, you will need to alter the DB encoding for your plugin tables. This should correct the issue.
-
This reply was modified 6 years, 9 months ago by
firebird75.
-
This reply was modified 6 years, 9 months ago by
firebird75.