I want to insert texts that have emojis in a MySQL table. I saw that it takes 4 bytes for each emoji because they come in 2 hexadecimals. The issue that I have seen there are different "solutions" and none of them worked for me.
Part of the error goes:
at java.lang.Thread.run (Unknown Source) Caused by: com.genexus.GXRuntimeException: java.sql.SQLException: Incorrect string value: '\ xF0 \ x9F \ x92 \ x98 \ xF0 \ x9F ...' for column 'TweetText' at row 1 at com.mysql.jdbc.SQLError.createSQLException (SQLError.java:1072) at com.mysql.jdbc.MysqlIO.checkErrorPacket (MysqlIO.java:3563) at com.mysql.jdbc.MysqlIO.checkErrorPacket (MysqlIO.java:3495) at com.mysql.jdbc.MysqlIO.sendCommand (MysqlIO.java:1959) at com.mysql.jdbc.MysqlIO.sqlQueryDirect (MysqlIO.java:2113) at com.mysql.jdbc.ConnectionImpl.execSQL (ConnectionImpl.java:2693) at com.mysql.jdbc.PreparedStatement.executeInternal (PreparedStatement.java:2102) at com.mysql.jdbc.PreparedStatement.executeUpdate (PreparedStatement.java:2395) at com.mysql.jdbc.PreparedStatement.executeUpdate (PreparedStatement.java:2313) at com.mysql.jdbc.PreparedStatement.executeUpdate (PreparedStatement.java:2298) at com.genexus.db.driver.GXPreparedStatement.executeUpdate (Unknown Source) at com.genexus.db.UpdateCursor.postExecute (Unknown Source) at com.genexus.db.DataStoreProvider.execute (Unknown Source) at com.genexus.db.DataStoreProvider.execute (Unknown Source)
Does anyone know how to set the mysql
, or client.cfg
or some workarround to achieve insert in the BD emojis?
The simplified code would be something like that, with &Tweet
being a variable of type Business Component in GeneXus and &itemresult
the result tweet of calling an API of Twitter:
&Tweet.TweetId=&itemresult.id_str
&Tweet.TweetText=&itemresult.text
&Tweet.Save()
commit
Thank you very much in advance