Character set converter for database tables.

This class is used to upgrade tables from "utf8" character set encoding to "utf8mb4" encoding. This allows for uses of 4 byte characters such as emoji and mathematical symbols.

In Backdrop this conversion may be done through UI at admin/config/development/utf8mb4-upgrade. More information about this upgrade can be found in the Backdrop documentation on database configuration:

Although this class is used within Backdrop purely for the utf8mb4 upgrade, it is a general purpose converter and could be used for other purposes in custom scripts or command-line tools.

Based on utf8mb4_convert by joelpittet and stefan.r.


Expanded class hierarchy of DatabaseCharsetConverter

See also




core/includes/database/, line 24


Contains filters are case sensitive
Namesort descending Modifiers Type Description
DatabaseCharsetConverter::$charset protected property Default character set to which data should be converted.
DatabaseCharsetConverter::$collation protected property Default collation to which data should be converted.
DatabaseCharsetConverter::$connection protected property The current connection for all operations.
DatabaseCharsetConverter::convertAllDatabases public function Convert the MySQL Backdrop databases character set and collation.
DatabaseCharsetConverter::convertDatabase public function Convert the database charset and collation, but not the tables within it.
DatabaseCharsetConverter::convertTable public function Converts a table to a desired character set and collation.
DatabaseCharsetConverter::convertTableFields public function Converts a table's field to a desired character set and collation.
DatabaseCharsetConverter::convertTables public function Converts all the tables defined by backdrop_get_schema().
DatabaseCharsetConverter::setConnection function Set the active connection for all operations.
DatabaseCharsetConverter::__construct public function DatabaseCharsetConverter constructor.