MySQL ERROR 1366: Incorrect string value: '\xF0\x9F\x98\x80' for column
The text contains characters (usually emoji) that the column’s character set can’t store — the column or connection is utf8/utf8mb3 instead of utf8mb4.
Meaning
MySQL’s legacy utf8 stores at most 3 bytes per character. Emoji and some CJK characters need 4 bytes (\xF0…). Both the column/table and the connection charset must be utf8mb4.
Common causes
- Column or table uses utf8/utf8mb3 or latin1
- Connection charset not utf8mb4 (DSN missing
charset=utf8mb4) - Database default charset outdated after migration
⚡ Quick fix
- Convert the table:
ALTER TABLE t CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; - Use
charset=utf8mb4in the connection DSN - Set database default to utf8mb4 for new tables
Detailed fix by platform
MySQL
- Convert database and table:sql
ALTER DATABASE appdb CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; ALTER TABLE comments CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
PHP
- PDO:
mysql:host=…;dbname=…;charset=utf8mb4. On old MySQL 5.6, indexed VARCHAR(255) columns may need to shrink to 191 for utf8mb4.
How to diagnose
- Column —
SHOW FULL COLUMNS FROM t— collation? - Connection —
SHOW VARIABLES LIKE 'character_set_%'from the app connection - Data — Emoji or 4-byte characters present?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026