Skip to content

Error 3988: Conversion from collation utf8mb4_general_ci into latin1_swedish_ci impossible for parameter #1298

@justin-wilxite

Description

@justin-wilxite

Issue description

I'm encountering this error when attempting to insert or update a latin1 column with a text parameter that is utf8 encoded and which contains unsupported characters.

Error 3988: Conversion from collation utf8mb4_general_ci into latin1_swedish_ci impossible for parameter

If I run the same query from the mysql command line, or using the PHP PDO client, there is no error and the unsupported characters are replaced with ?s. I'd prefer to get that behaviour instead of the error.

This is specific to MySQL 8.

Example code

db, err := sql.Open(dbDriver, dbUser+":"+dbPass+"@tcp("+dbHost+")/"+dbName+"?parseTime=true")
_, err = db.Exec("UPDATE notes SET text=? WHERE id=72", "cżcż")
if err != nil {
	log.Fatal(err)
}

Configuration

Driver version (or git SHA): 1.6.0

Go version: 1.17.5

Server version: MySQL 8.0.23

Server OS: CentOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions