I'm facing an issue while trying to store the Chinese character '𧗽' (U+275FD) in a MySQL database table that uses the utf8mb4 character set. I have verified that both the database and the specific table are set to utf8mb4, but I'm still receiving an error when attempting to insert this character.
Here are the details of my setup:
Attribute | Value |
---|---|
MySQL Version | 8.4.2 |
PHP Version | 8.3.12 |
Table Charset | utf8mb4 |
Table Collation | utf8mb4_unicode_ci |
Column Charset | utf8mb4 |
Error Message
General error: 1366 Incorrect string value: 'U+275FD' for column 'chinese' at row 1 [ INSERT INTO `Staff` (`staff_no`, `name`, `chinese`, `TYPE`, `email`, `sex`) VALUES ('12345', 'HANG HANG HANG', '𧗽', 'D', 'hhh_03@example.com.hk', 'M') ] in /var/www/html/evs/vendor/opis/database/src/Connection.php:567Stack trace:#0 /var/www/html/evs/vendor/opis/database/src/Connection.php(426): Opis\Database\Connection->execute()#1 /var/www/html/evs/vendor/opis/database/src/SQL/Insert.php(47): Opis\Database\Connection->command()#2 /var/www/html/evs/cron/night-job.php(77): Opis\Database\SQL\Insert->into()#3 {main} thrown in /var/www/html/evs/vendor/opis/database/src/Connection.php on line 567
The DBeaver is able to update the Chinese attribute by simply:
-- Auto-generated SQL script. Actual values for binary/complex data types may differ - what you see is the default string representation of values.UPDATE voting_system.Staff SET chinese='𧗽𧗽𧗽' WHERE staff_no='12345';
Without any error.
I would appreciate any insights into why this character isn't being stored correctly and any steps I can take to resolve the issue. Thank you!