Bug #118250 Using character set utf8mb4 shows as question marks
Submitted: 22 May 11:12 Modified: 29 May 12:01
Reporter: David Syers Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: mysqldump Command-line Client Severity:S2 (Serious)
Version:9.3, 8.4.5 OS:MacOS
Assigned to: CPU Architecture:ARM

[22 May 11:12] David Syers
Description:
In version 9.2 and 8.4.4 if we ran mysqldump using --default-character-set=utf8mb4 the table would dump as expected. But in the latest version UTF8 characters now dump as question marks.

It does seem to work with --default-character-set=utf8, but haven't tested enough characters to be absolutely sure

How to repeat:
You can use the simple table below, and then try and dump using --default-character-set=utf8mb4

------------------

CREATE TABLE `aaa` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `str` varchar(200) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

INSERT INTO `aaa` (`id`, `str`) VALUES
(1, 'لللإدددددب'),
(2, 'привет');

------------------

This then results in the dump:

------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Dumping data for table `aaa`
--

/*!40000 ALTER TABLE `aaa` DISABLE KEYS */;
INSERT INTO `aaa` (`id`, `str`) VALUES (1,'??????????'),(2,'??????');
/*!40000 ALTER TABLE `aaa` ENABLE KEYS */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

------------------
[29 May 12:01] MySQL Verification Team
Hello David Syers,

Thank you for the bug report.
We tried to reproduce your issue with MySQL Server 8.0.42, 8.4.5 and 9.3 but not seeing any issues at our end.
Please let us know if we are missing out something.

Regards,
Ashwini Patil
[29 May 12:11] MySQL Verification Team
test results

Attachment: 118250_test_results.txt (text/plain), 7.33 KiB.