Skip to content

Charsets in the DSN Config is lowercase and cannot be used #1664

Closed
@modelorona

Description

@modelorona

mysql/dsn.go

Line 47 in 85c6311

charsets []string // Connection charset. When set, this will be set in SET NAMES <charset> query

Based on the README docs, shouldn't this be capitalized as to let it be used?

Activity

methane

methane commented on Jan 27, 2025

@methane
Member

I don't like the charsets list.
I will provide functional option for charset.

modelorona

modelorona commented on Jan 27, 2025

@modelorona
Author

Cool, thanks :)

methane

methane commented on Feb 20, 2025

@methane
Member

charset can be list. e.g. "utf8,utf8mb4,utf8mb3". In this case, user can not specify collation. Should we provide a way to multiple charset/collation pair? I don't want to do...

My current idea is:

// Charset sets charsets and collation.
//
// When collate is empty, server's default collation is used. (e.g. `SET NAMES <charset>`.)
// Otherwise, both of charset and collate is used. (e.g. `SET NAMES <charset> COLLATE <collate>`.)
func Charset(charset, collation string) Option

Should this charset supports comma separated charsets?

added a commit that references this issue on Mar 10, 2025
c879816
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @methane@modelorona

      Issue actions

        Charsets in the DSN Config is lowercase and cannot be used · Issue #1664 · go-sql-driver/mysql