Custom DB_COLLATE (collation) value not working on fresh install?

I always knew that WordPress uses utf8_general_ci as tables collation, but recently it keeps installing utf8mb4_unicode_520_ci. What I do is: Download WordPress from wordpress.org Rename wp-config-example.php to wp-config.php Set the defined constants as below /** Database Charset to use in creating database tables. */ define('DB_CHARSET', 'utf8'); /** The Database Collate type. Don't change this if in doubt. */ define('DB_COLLATE', 'utf8_general_ci'); Set database configuration properly and create an empty database with charset and collation as above. Open mysite.dev where the WordPress …
Category: Web

Problem in adding new site on WP multisite

It's for two or three months that this problem exists in WordPress multisite and I'm still waiting for a solution or an update. When adding new site, I get this error: Warning: preg_match() expects parameter 2 to be string, object given in wp-includes/formatting.php on line 3435 Warning: preg_match() expects parameter 2 to be string, object given in wp-includes/formatting.php on line 3424 Warning: preg_match() expects parameter 2 to be string, object given in wp-includes/formatting.php on line 3435 Warning: strip_tags() expects parameter …
Category: Web

How to stop WordPress using utf8mb4_unicode_520_ci collation?

Recently I've installed PHP7 on my MAMP and updated to newest version of WordPress. Every time I do a new site all my tables are using collation utf8mb4_unicode_520_ci I have tried setting define('DB_COLLATE', 'utf8_general_ci'); in my wp-config.php which worked fine until Gravity Forms ignored it and created all it's tables in utf8mb4_unicode_520_ci I've seen that if utf8mb4_unicode_520_ci is available it will use that so is there a surefire way to stop WP using that collation? Can I just remove that …
Category: Web

Default table collation on plugin activation?

I'm following this to make my plugin auto-create a table when the plugin is activated, but what happens is that while all the tables (the whole db) are utf8_general_ci, the newly created table is latin1_swedish_ci... Why isn't it also utf8? I thought it would also be utf8 by default since I have: define('DB_COLLATE', 'utf8_general_ci'); in my wp-config.php... I have everything exactly the same like in the link provided, except the function name, and I have different SQL fields... How to …
Category: Web

Hebrew Characters Have gone bad

I have read this question: I have tried the following: ALTER database mydbname CHARACTER SET utf8 COLLATE utf8_general_ci; ALTER table ext_hebrewText CHARACTER SET utf8 COLLATE utf8_general_ci; My table has one column in Hebrew: And I have various Javascripts that format and color it to show on the screen. This is the way it is current showing: With some other changes, I see all question marks. My current config.php settings are: /** Database Charset to use in creating database tables. */ …
Category: Web

Unknown collation when I import a dump from an existing site into a development database?

I exported the sql from an existing database for an existing site that's hosted on Bluehost. I'd like to be able to import it into the development environment without hitting an issue; I'm flexible, I can change the MySQL version I'm using in the development environment; my goal is to make it as easy as possible to import the exported sql code into the development environment without all these errors. That said is there anything I can do about this? …
Category: Web

Please explain how Wordpress works with MySQL character set and collation at a low level

As the question title suggests, I'm looking to understand how Wordpress works with MySQL character sets and collation options. As I will show below, things don't make much sense to me... I installed Wordpress by following the instructions on their installation page: https://codex.wordpress.org/Installing_WordPress As part of the instructions, I followed their advice for manual creation of the MySQL database on the commandline, namely the commands: mysql> CREATE DATABASE databasename; Query OK, 1 row affected (0.00 sec) mysql> GRANT ALL PRIVILEGES …
Category: Web

How to stop WordPress from using utf8mb4_unicode_ci collation

I'm using WP Sync DB plugin for migrating sites between dev, stage and live. Recently i ran in this problem: while creating a new instance on my local dev, WordPress created all tables with utf8mb4_unicode_ci. This leads to problems getting the data migrated. Also live servers often don't support utf8mb4 at all. I already set define('DB_COLLATE', 'utf8_general_ci'); but WordPress ignoredt it on creation. Any ideas?
Category: Web

Wordpress character set issue

I'm currently migrating a wordpress site to a live server. When trying to import my database via phpMyAdmin I run across the following error below: Error CREATE TABLE `wp_commentmeta` ( `meta_id` BIGINT( 20 ) UNSIGNED NOT NULL , `comment_id` BIGINT( 20 ) UNSIGNED NOT NULL DEFAULT '0', `meta_key` VARCHAR( 255 ) COLLATE utf8mb4_unicode_520_ci DEFAULT NULL , `meta_value` LONGTEXT COLLATE utf8mb4_unicode_520_ci ) ENGINE = INNODB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_520_ci; How can I swiftly resolve this?
Category: Web

Database with mixed collation (utf8mb4 & utf8_general_ci)

Each time I was uploading my WP install from offline to online, I was noticing strange characters in text and digging a bit I have discovered that wp-config.php on the online server was set to define('DB_CHARSET', 'utf8mb4'); so each time I would upload the new "release" I had to edit to wp-config.php to utf8 to display correctly extended characters. Lately I have discovered (through phpmyadmin) not only that the default collation sequence on my install is set to utf8mb4, but …
Category: Web

"Error 1064" when importing msql database after updating wordpress version to 4.2.1

I have a error in importing my sql file that contains the db of my site When i export from local, is ok my settings Server: mysql wampserver (127.0.0.1 via TCP/IP) Server type: MySQL Server version: 5.6.17 - MySQL Community Server (GPL) Protocol version: 10 User: root@localhost Server charset: UTF-8 Unicode (utf8) Web server Apache/2.4.9 (Win64) PHP/5.5.12 Database client version: libmysql - mysqlnd 5.0.11-dev - 20120503 - $Id: bf9ad53b11c9a57efdb1057292d73b928b8c5c77 $ PHP extension: mysqli Documentation my OS is windows 7 and …
Category: Web

How do I convert a MySQL database from utf8mb4 to utf8 encoding?

What happened: I had my blog hosted on SiteGround and my plan expired. I created a full website backup first which contained all the files including the public_html folder adn the databases associated with my WordPress blog. The issue I'm having now is that I can't upload my databases on my current host (000WebHost) because it won't read the utf8mb4 encoded mysql files. The error I get is: 1273 - Unknown collation: 'utf8mb4_unicode_ci' I looked for ways to convert utf8mb4 …
Category: Web

database collation differences

I have a database for a site I am developing in WAMP. The collation for the database is latin1_swedish_ci but every table in the database is utf84mb_unicode_ci. Should I be worried about this? In the future I can use utf84mb_unicode_ci for both, but what about the databases I already have content in?
Category: Web

Character Encoding for wp_options

I've been looking for a solution to my problem for a while now. Under my wp_options page I have the following serialized entry saved: a:17:{s:11:"date_format";s:5:"d/m/Y";s:15:"currency_symbol";s:1:"$";s:14:"recaptcha_lang";s:2:"en";s:13:"req_div_label";s:0:"";s:16:"req_field_symbol";s:1:"*";s:15:"req_error_label";s:81:"Por favor, certifique-se de que todos os campos obrigatórios estão preenchidos.";s:15:"req_field_error";s:29:"Este é um campo obrigatório";s:10:"spam_error";s:53:"Por favor responda a pergunta anti-spam corretamente.";s:14:"honeypot_error";s:41:"Por favor, deixar o campo spam em branco.";s:18:"timed_submit_error";s:47:"Por favor, aguarde a submissão do formulário.";s:16:"javascript_error";s:75:"Você não pode submeter o formulário sem que o Javascript esteja ativado.";s:13:"invalid_email";s:50:"Por favor entre com um endereço de email válido.";s:13:"process_label";s:11:"Processando";s:17:"password_mismatch";s:35:"As senhas informadas não …
Category: Web

One for the gurus: upgrade to 3.x messed up only filenames with accented chars

After upgrading from 2.8.x (maybe it was 2.9.x) to 3.1.2, all the references inside posts to filenames (usually images) which contain accented chars stopped working. Before, filenames that are displayed in the filesystem like "EXPRESSÃO.jpg" would be correctly called out in the post content HTML as "EXPRESSÃO.jpg". WP 3.x decided to convert those references to "EXPRESSÃO.jpg" (which is what the filename looked like when created/uploaded by the blog author), so now all the images that have such chars are broken …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.