Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi @all,
Problem/Motivation
The problem I have is, that backups made by this module don't restore emoji unicode characters. After restoring a backup it's displayed as ??? e.g. inside a body field.
Steps to reproduce
The Database of my Drupal 8.7.3 supports collation utf8mb4_unicode_ci
- Insert in a body field a glyph of an emoji (Example)
- Create a backup with Backup and Migrate
- Restore the backup with Backup and Migrate
- At the place where the emoji should be displayed, there's only ???? shown
Comment | File | Size | Author |
---|---|---|---|
#8 | backup_migrate-n3065017-8-5.x.patch | 1.04 KB | DamienMcKenna |
#8 | backup_migrate-n3065017-8-4.x.patch | 1.12 KB | DamienMcKenna |
|
Comments
Comment #2
dercheffeComment #3
ikit-claw CreditAttribution: ikit-claw as a volunteer commentedWhat exactly are you using to add emoji's? Or is this just drupal core?
Comment #4
dercheffeIn this case I pasted it for testing into a body field directly, only using core's CKEditor.
In general it works, until a backup is restored via BAM.
But I also observed the same behavior earlier using CKEditor Emojione module on another site (but it has a bug currently, so its not usable in general for now).
Comment #5
dercheffeOkay, following I observed in the meanwhile:
drush sql:dump
command. I don't know if BAM code relies on the same code base.mysqldump
command for creating the backup (not with BAM) without any parameter in my shell also brings the same error result--default-character-set=utf8mb4
it's all working as it should. Emojis are still there after restore of the backupFound this here: https://stackoverflow.com/questions/20216849/mysqldump-with-utf8-can-not-export-the-right-emojis-string
When I analyze the BAM MySQL dump I've observed following:
SET NAMES utf8;
although there should be autf8mb4_unicode_ci
?Comment #6
Promo-IL CreditAttribution: Promo-IL commented+1
I've done /backup_migrate/lib/backup_migrate_core/src/Source/MySQLiSource.php
Comment #7
DamienMcKennaOh, that's a great find, thank you Promo-IL! Bumping this to critical because it causes data problems.
To anyone who wants to fix their backups, just change the line "SET NAMES utf8" in the SQL file to "SET NAMES utf8mb4" and you should be able to reimport the database correctly.
Comment #8
DamienMcKennaOk, this should resolve it for new files, existing backup files will need to have that line in the output changed.
Comment #11
DamienMcKennaCommitted.