Hi, I’m trying to persist data in a database, but the insert statement returns this error :
Error 1366: Incorrect string value: 'xA9x073xEBExF3...' for column 'secret' at row 1
This is the part of the code not working :
_, err = db.Query("INSERT INTO authentication (secret, token_id, last_login) VALUES(?, ?, ?)", secret, jwtId, datetime) fmt.Println(utf8.ValidString(secret))
utf8.ValidString(secret) returns false, and I don’t really understand why.
jwtId) are generated with
ksuid.New() from https://github.com/segmentio/ksuid. I converted this value like this :
Any idea how to solve this problem? What’s more, I’m a bit surprised. I though all strings in Go were UTF8 encoded. Can someone explain to me what’s wrong ? Thanks.