2
votes

I'd like to use Google Cloud SQL for my app, but I require that utf8mb4 be set as the server character set in order to correctly process 4 byte utf8 characters (emoji).

It is not enough to simply set the table or database character set because the driver connection (mysql-connector-java) is negotiated based on the server character set.

Is it possible to set the server character set with Cloud SQL?

If not, is there another workaround that could allow me to force the driver connection to utf8mb4?

Here is a copy of my connection string: jdbc:mysql://<host>/<db_name>?useUnicode=true&characterEncoding=utf-8

Note that setting the characterEncoding variable in the driver connection string to utf-8mb4 or utf8mb4 is illegal. My best information say that it has to be set to utf-8 and then it will upgrade to utf8mb4 if the server is using that character set.

1
Hi there. We heard you :) I am getting together the functionality to change the character-set-server flag between utf8 and utf8mb4. I'm aiming for it to launch sometime the week beginning May 25th 2014. You'll see it in the Cloud Console when it's out, and I will try to make sure to update this question too. Thanks for the feedback! - cflewis
Wow! Now that's what I call service. Looking forward to the update. - cmorris

1 Answers

1
votes

It looks like this feature has been added to the new instance menu on the console as of 5/29/2014. There is now a "character_set_server" flag that can be set to either utf8 or utf8mb4.

This does not allow setting the server character set to any arbitrary character set, but it does solve my problem and should suffice for most people.