mysql_set_character_set - Man Page

Name

mysql_set_character_set - Sets the default character set for connection

Synopsis

#include <mysql.h>

int mysql_set_character_set(MYSQL * mysql,
                            const char * csname);

Description

Sets the default [data-types-character-sets-and-collations()](character set]] for the current connection. Returns zero on success, non-zero on failure.

Parameters

  • mysql - a mysql handle, which was previously allocated by mysql_init() (mysql_init) or mysql_real_connect(3).
  • csname - character set name ### Notes
  • It’s strongly recommended to use mysql_set_character_set() instead of SET NAMES ... since mysql_real_escape_string(3) might fail or deliver unexpected results.

Return value

Zero on success, non zero if an error occured

Supported character sets

The client library supports the following character sets:

Character setDescription
armscii88 bit character set for Armenian
asciiUS ASCII character set
big52 byte character set for traditional Chinese, Hongkong, Macau and Taiwan
binary8 bit binary character set
cp1250Windows code page 1250 character set
cp1251Windows code page 1251 character set
cp1256Windows code page 1256 character set
cp1257Windows code page 1257 character set
cp850MS-DOS Codepage 850 (Western Europe)
cp852MS-DOS Codepage 852 (Middle Europe)
cp866MS-DOS Codepage 866 (Russian)
cp932Microsoft Codepage 932 (Extension to sjis)
dec8DEC West European
eucjpmsUJIS for Windows Japanese
euckrEUC KR-Korean
gb2312GB-2312 simplified Chinese
gbkGBK simplified Chinese
geostd8GEOSTD8 Georgian
greekISO 8859-7 Greek
hebrewISO 8859-8 Hebrew
hp8HP West European
keybcs2DOS Kamenicky Czech-Slovak
koi8rKOI8-R Relcom Russian
koi8uKOI8-U Ukrainian
latin1CP1252 Western European
latin2ISO 8859-2 Central Europe
latin5ISO 8859-9 Turkish
latin7ISO 8859-13 Baltic
macceMAC Central European
macromanMAC Western European
sjisSJIS for Windows Japanese
swe77-bit Swedish
tis620TIS620 Thai
ucs2UCS-2 Unicode
ujisEUC-JP Japanese
utf8UTF-8 Unicode
utf16UTF-16 Unicode
utf32UTF-32 Unicode
utf8mb4UTF 4-byte Unicode

See also

Referenced By

mysql_get_character_set_info(3).

Version 3.3.1 MariaDB Connector/C