Skip to content

Prepare protocol is broken on non-utf8 charset since #28925 #58870

@xhebox

Description

@xhebox

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

	connStr := fmt.Sprintf("%s:%s@tcp(%s:4000)/test?charset=gbk", user, pwd, dsn)
	db, err := sql.Open("mysql", connStr)
	if err != nil {
		log.Fatalf("SQLConnect failed: %v", err)
	}
	defer db.Close()
	gbkStr := []byte{0xB2, 0xE2, 0xCA, 0xD4} // GBK encoded "测试"
	execWithPrepare(db, fmt.Sprintf("INSERT INTO tsecurity (security_id, security_code, mkt_id, security_name) VALUES (1, '1', 1 ,'%s')", gbkStr))
}

2. What did you expect to see? (Required)

succeed

3. What did you see instead (Required)

Incorrect string value...

4. What is your TiDB version? (Required)

Metadata

Metadata

Assignees

No one assigned

    Labels

    affects-5.4This bug affects the 5.4.x(LTS) versions.affects-6.1This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.report/customerCustomers have encountered this bug.severity/moderatesig/sql-infraSIG: SQL Infratype/bugThe issue is confirmed as a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions