# Method Sql.Sql()->set_charset()

Method set_charset

  ``void` set_charset(`string` `charset`)`

Description

  Changes the charset that the connection uses for queries and returned text strings.

Parameter `charset`

  The charset to use. The valid values and their meanings depends on the database brand. However, the special value `"unicode"` (if supported) selects a mode where the query and result strings are unencoded (and possibly wide) unicode strings.

Throws

  An error is thrown if the connection doesn't support the specified charset, or doesn't support charsets being set this way at all.

Note

  See the `set_charset` functions for each database connection type for further details about the effects on the connection.

See also

  get_charset, Sql.mysql.set_charset