golang / go

The Go programming language
https://go.dev
BSD 3-Clause "New" or "Revised" License
124k stars 17.67k forks source link

affected/package: database/sql #53476

Closed guijunchen closed 2 years ago

guijunchen commented 2 years ago

1、mysql my.cnf config: [client] default-character-set=utf8mb4 [mysql] default-character-set=utf8mb4 [mysqld] character-set-server=utf8mb4 collation-server = utf8mb4_general_ci

MySQL database and table have been set to utf8mb4 character set

2、 problem: Insert "Клубная карта доступа к закрытому сообществу." into the database through database/sql and report an error: Error 1366: Incorrect string value: '\xD1' for column 'name' at row 1

Insert "Клубная карта доступа к закрытому" into database successfully through database/sql

Insert "Клубная карта доступа к закрытому сообществу." into the database successfully through navicat premium database tool

So I think the problem is a database/sql bug.

What version of Go are you using (go version)?

$ go version
go version go1.17.11 darwin/amd64

Does this issue reproduce with the latest release?

uncertain

What operating system and processor architecture are you using (go env)?

GOHOSTARCH="amd64" GOHOSTOS="darwin"

go env Output
$ go env
ook@BookdeMBP token % go env
GO111MODULE=""
GOARCH="amd64"
GOBIN="/Users/book/work/code/go/bin"
GOCACHE="/Users/book/Library/Caches/go-build"
GOENV="/Users/book/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/book/work/code/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/book/work/code/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go@1.17/1.17.11/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go@1.17/1.17.11/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.17.11"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/book/work/code/tokenbankteam/server/tb_server/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/3f/2116w1qj4bz8v7xt4_ch4t8r0000gn/T/go-build3109971056=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

blockchain developer

What did you expect to see?

I want to be able to insert "Клубная карта доступа к закрытому сообществу." into mysql database via database/sql

What did you see instead?

SiddheshKukade commented 2 years ago

Please explain in english

guijunchen commented 2 years ago

Please explain in english yes, I modified it to be more friendly but I am not a native English speaker

seankhliao commented 2 years ago

Sounds like a database driver issue, please report to them