I have a structure. I encode it in a json format.
Next, I try to write this data to MySql. Table has utf8_unicode_ci.
data_json, err := json.Marshal(data)
db, err := sql.Open("mysql", ...)
stmt, err := db.Prepare("INSERT INTO my_table (data) VALUES (?)")
res, err = stmt.Exec(data_json)
But I have an error:
Error 1366: Incorrect string value: '\xF0\x9F\x8E\x81 \xD0...' for column 'data' at row 1
How I can remove or replace this characters in the string using Golang?