OiO.lk Blog PHP Unable to Store Chinese Character '𧗽' in MySQL with utf8mb4 Charset
PHP

Unable to Store Chinese Character '𧗽' in MySQL with utf8mb4 Charset


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
Table Charset utf8mb4
Table Collation utf8mb4_unicode_ci
Column Charset utf8mb4

Error Message

General error: 1366 Incorrect string value: '\xBD\xBD\xBD' 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:567
Stack 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

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!



You need to sign in to view this answers

Exit mobile version