Openshift MySql Emoji support

167 Views Asked by At

I'm trying to support emoji on Openshift MySql cartridge. I've set the UTF8mb4 character set following a few guides, but it doesn't seem to work. When i try to INSERT an emoji in a VARCHAR field, it instead stores "????". Is this an Openshift problem? Does anybody know how to fully support emoji?

1

There are 1 best solutions below

2
Rick James On

Multiple question marks usually means that the table/column is declared CHARACTER SET latin1. See SHOW CREATE TABLE to check.

That is only one of 4 places that you need to specify utf8mb4:

  • Presumably the Emoji bytes are utf8 already.
  • SET NAMES utf8mb4 -- or whatever the equivalent in openshift/cartridge is for establishing the connection.
  • The table/column must be CHARACTER SET utf8mb4.
  • Html needs <meta ... charset=UTF-8>