Reputation: 21
I'm working as a DBA on mysql 5.5.24 servers. Recently we faced one issue in production when one user tries to LogOn from iPhone and its phone name was having emoji character in itself.
Currently, in our system we have utf8 charset, which supports 3 bytes, but as its phone name was having emoji (4 bytes), the registration failed.
As mentioned in this link, we tried to reproduce same scenario in our development setup but still faces issues:
Java Logs:
2013-01-08 11:21:54,547 ERROR [org.hibernate.util.JDBCExceptionReporter] (http-0.0.0.0) Incorrect string value: '\xF0\x9F\x98\x84' for column 'deviceDescription' at row 1
DB Logs:
insert into deviceDetails (deviceDescription, remoteStatus, deviceStatus) values ('?', 0, 1)
Note: Charset at Java side is still utf8. Can it be an issue?
Upvotes: 2
Views: 2934
Reputation: 141
See here. Also make sure that your connection character set is utfmb4.
Db characterset: utf8mb4
Client characterset: utf8mb4
Conn. characterset: utf8mb4
Upvotes: 2
Reputation: 1
Here is the query to insert:
insert into homeDetails (homeId, homeDescription, routerMac, routerSSID, arpMac, homeDetailTS)values (123,'des','mactest',convert ('Emot😄RS'using utf8mb4),'aprtest', now());
Upvotes: 0