Emoji insert exception
See original GitHub issueMy code is
var sql = "INSERT IGNORE INTO cs SET " +
"cs_title=?," +
...
conn.query(sql, {
replacements: [course.name, ...],
type: sequelize.QueryTypes.INSERT
}).then(function (courseId) {
...
when insert 我的心😘😉😘’
case this exception
UPDATE cs SET cs_title='我的心😘😉😘',....
Unhandled rejection SequelizeDatabaseError: ER_TRUNCATED_WRONG_VALUE_FOR_FIELD: Incorrect string value: '\xF0\x9F\x98\x98\xF0\x9F...' for column 'cs_title' at row 1
at Query.formatError (/home/Tinstone-Course-Server/node_modules/sequelize/lib/dialects/mysql/query.js:175:14)
at Query._callback (/home/Tinstone-Course-Server/node_modules/sequelize/lib/dialects/mysql/query.js:49:21)
at Query.Sequence.end (/home/Tinstone-Course-Server/node_modules/mysql/lib/protocol/sequences/Sequence.js:85:24)
at Query.ErrorPacket (/home/Tinstone-Course-Server/node_modules/mysql/lib/protocol/sequences/Query.js:94:8)
at Protocol._parsePacket (/home/Tinstone-Course-Server/node_modules/mysql/lib/protocol/Protocol.js:280:23)
at Parser.write (/home/Tinstone-Course-Server/node_modules/mysql/lib/protocol/Parser.js:74:12)
at Protocol.write (/home/Tinstone-Course-Server/node_modules/mysql/lib/protocol/Protocol.js:39:16)
at Socket.<anonymous> (/home/Tinstone-Course-Server/node_modules/mysql/lib/Connection.js:109:28)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:172:18)
at Socket.Readable.push (_stream_readable.js:130:10)
at TCP.onread (net.js:542:20)
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Insert statements working when inserting emojis, but throws ...
Whereas Emoji characters are up to 4 bytes long. Therefore we need to use utf8mb4 as our charset. Solution: 1. Open your config/database.php....
Read more >How to Insert Emojis In Excel | Fix Emoji Error In Excel
How to Insert Emojis In Excel | Fix Emoji Error In Excel Thanks For Watching,Please Like, Share & Subscribe #datharamesh For More Videos....
Read more >Unable to insert emoji into USER_COMMIT ... - Atlassian
Unable to insert emoji into USER_COMMIT. ... Exception: JDBC exception on Hibernate data access: SQLException for SQL [insert into USER_COMMIT ...
Read more >Emoji Keyboard - Microsoft Community
Emoji Keyboard. I keep getting an error when i try to insert an emoji in a Word document... This thread is locked.
Read more >emoji character causing PDOException [#2375541] | Drupal.org
emoji character causing PDOException ... When a user adds an emoji to their message, the site shows shows the 'Site Offline' message and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @dongtong , Did you created the table first then set the it to
utf8mb4
? Please re-create the table with charsetutf8mb4
and see if you can insert strings properly after that.Hi @DzmitryU DZ This configuration works for me config database charset. You should give it a try.