I am writing strings to our 5.6 MySQL server and am getting all sorts of weird behavior. Things start off working fine but eventually I get encoding errors and SwlException errors.
The table and session wncoding is all set to utf8mb4 and I can copy and paste emojis just fine in SequelPro. However unless I add
useUnicode=True&characterEncoding=utf8
It converts all the emojis to ??? but then when I add those to the jdbcurl it turns all my emojis into symbols like ¥ which leads me to believe it’s an encoding issue.
for example Like these: ðŸ…🥬ðŸ¥'ðŸ¥'
This used to work! Then one day it just started writing those weird symbols instead of emojis. So I had to start messing with session variables.
Weirdly if I set the session variables to utf8 in the jdbcurl it works properly writing emojis like you expect to the database
&sessionVariables=character_set_client=utf8,character_set_connection=utf8,character_set_results=utf8
Which doesn’t make much sense but it’s all I could get to work.
But eventually after an hour or two of writing stuff I will get a string exception like
java.sql.SQLException: Incorrect string value: '\xF0\x9F\x91\xBD\xF0\x9F...'
I have verified that there are working by inserting debug statements into kotlin. It’s an issue with jdbc and the database.
Anybody run into this before?
All of it works fine in a preciously written piece of php code but that turns the emojis into Unicode escape sequences when it writes to the db. (Which I could never get to work from kotlin)
I can’t figure out why it would work and then all the sudden break. Can the session variables change if there are more to an one connection open at once?
Thanks.