pressidium / pressidium-cookie-consent

🍪 Lightweight, user-friendly and customizable cookie consent banner to help you comply with the EU GDPR cookie law and CCPA regulations.
https://wordpress.org/plugins/pressidium-cookie-consent/
GNU General Public License v2.0
45 stars 2 forks source link

Store emoji in a database using utf8 #15

Closed over-engineer closed 1 year ago

over-engineer commented 1 year ago

When WordPress is installed on a database using the utf8mb4 character set, everything works correctly.

However, issues arise when WordPress is installed on a database using the utf8 charset and an emoji character is present in any text field on the plugin’s settings page.

MySQL’s utf8 charset (an alias of utf8mb3) stores up to three bytes per character, while utf8mb4 can store up to 4 bytes characters as well. We need that fourth byte to support storing emoji characters.

To prevent the plugin from breaking when used on a database using the utf8 charset, we need to convert any emoji characters into their equivalent HTML entities and store them in the database instead.

over-engineer commented 1 year ago

Closing as resolved.