awesomemotive / wp-mail-logging

:envelope: Logs each email sent by WordPress.
48 stars 25 forks source link

Change DB table charset to utf8mb4 #151

Closed dakegordon-AM closed 1 year ago

dakegordon-AM commented 1 year ago

When logging emails containing utf-8 characters that need 4 or more bytes to be encoded, it can fail, since the table is created using the utf8 charset and not the utf8mb4.

Suggestion: use “create” statement to use the global variable $charset_collate, provided by WP which contains the query with the right charset and collation.

$sql = "CREATE TABLE... id int(11) NOT NULL AUTO_INCREMENT, ... PRIMARY KEY (id) ) $charset_collate;";

Related GH issue: https://github.com/awesomemotive/wp-mail-logging/issues/146