I am experiencing some issue with MySQL encoding parsing data and then storing data from the Twitter API.
The tweet that struggles to get stored into the db is:
INSERT INTO `statuses` (`status_id`,`text`) VALUES('93332222111111','The beers are on me in this case!�')
The �
character is this one.
whereas the following got stored successfully:
INSERT INTO `statuses` (`status_id`,`text`) VALUES('485072105225921','RT @someone: Don\'t forget to index timestamp columns like \"created_at\" if you query against them.\n\ne.g.: ORDER BY created_at\ne.g.: WH')
Let's have a look into the character set:
SHOW VARIABLES LIKE 'character_set%'
which brings back
character_set_client utf8mb4
character_set_connection utf8mb4
character_set_database utf8mb4
character_set_filesystem binary
character_set_results utf8mb4
character_set_server utf8
character_set_system utf8
character_sets_dir /usr/local/Cellar/mysql/5.7.18_1/share/mysql/charsets/
Anything obvious that I am missing?
Update: Also the following if block:
if utf8.ValidString(strings.Join(values, ",")) == false {
fmt.Println(strings.Join(values, ","))
}
returns:
'The beers are on me in this case!�','943304851980963841'