Skip to content

Instantly share code, notes, and snippets.

@NicolaeNMV
Last active February 14, 2016 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NicolaeNMV/6909e217df58a85791a5 to your computer and use it in GitHub Desktop.
Save NicolaeNMV/6909e217df58a85791a5 to your computer and use it in GitHub Desktop.
Slick mysql playframework 2.4 configure for emoji
The default utf8 character set doesn't support emoji characters, you'll see `[SQLException: Incorrect string value: '\xF0\x9F\x98\x8A P...' for ` exception when trying to insert data.
You'll need utf8mb4 character set to be able to sotre emoji characters.
1. You'll need to create all the tables with CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci option
2. After initializing the conneciton, you will need to send SET NAMES utf8mb4,
you can do that with the hikari connectionInitSql option, a SQL statement that will be executed after the connetion was initialized.
slick.dbs.default.db.connectionInitSql="set names utf8mb4"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment