Last active
February 14, 2016 11:17
-
-
Save NicolaeNMV/6909e217df58a85791a5 to your computer and use it in GitHub Desktop.
Slick mysql playframework 2.4 configure for emoji
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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