1mysql_set_character_set(3)    MariaDB Connector/C   mysql_set_character_set(3)
2
3
4
5   Name
6       mysql_set_character_set - Sets the default character set for connection
7
8   Synopsis
9              #include <mysql.h>
10
11              int mysql_set_character_set(MYSQL * mysql,
12                                          const char * csname);
13
14   Description
15       Sets the default [data-types-character-sets-and-collations()](character
16       set]] for the current connection.  Returns zero on success, non-zero on
17       failure.
18
19   Parameters
20       • mysql   -   a   mysql  handle,  which  was  previously  allocated  by
21         mysql_init() (mysql_init) or mysql_real_connect(3).
22
23       • csname - character set name ### Notes
24
25       • It’s strongly recommended to use mysql_set_character_set() instead of
26         SET NAMES ... since mysql_real_escape_string(3) might fail or deliver
27         unexpected results.
28
29   Return value
30       Zero on success, non zero if an error occured
31
32   Supported character sets
33       The client library supports the following character sets:
34
35       Character set                         Description
36       ──────────────────────────────────────────────────────────────────────────
37       armscii8                              8 bit character set for Armenian
38       ascii                                 US ASCII character set
39       big5                                  2 byte character set for tradition‐
40                                             al  Chinese,  Hongkong,  Macau  and
41                                             Taiwan
42       binary                                8 bit binary character set
43       cp1250                                Windows code  page  1250  character
44                                             set
45       cp1251                                Windows  code  page  1251 character
46                                             set
47       cp1256                                Windows code  page  1256  character
48                                             set
49       cp1257                                Windows  code  page  1257 character
50                                             set
51       cp850                                 MS-DOS Codepage  850  (Western  Eu‐
52                                             rope)
53       cp852                                 MS-DOS Codepage 852 (Middle Europe)
54       cp866                                 MS-DOS Codepage 866 (Russian)
55       cp932                                 Microsoft  Codepage  932 (Extension
56                                             to sjis)
57       dec8                                  DEC West European
58       eucjpms                               UJIS for Windows Japanese
59       euckr                                 EUC KR-Korean
60       gb2312                                GB-2312 simplified Chinese
61       gbk                                   GBK simplified Chinese
62       geostd8                               GEOSTD8 Georgian
63       greek                                 ISO 8859-7 Greek
64       hebrew                                ISO 8859-8 Hebrew
65       hp8                                   HP West European
66
67       keybcs2                               DOS Kamenicky Czech-Slovak
68       koi8r                                 KOI8-R Relcom Russian
69       koi8u                                 KOI8-U Ukrainian
70       latin1                                CP1252 Western European
71       latin2                                ISO 8859-2 Central Europe
72       latin5                                ISO 8859-9 Turkish
73       latin7                                ISO 8859-13 Baltic
74       macce                                 MAC Central European
75       macroman                              MAC Western European
76       sjis                                  SJIS for Windows Japanese
77       swe7                                  7-bit Swedish
78       tis620                                TIS620 Thai
79       ucs2                                  UCS-2 Unicode
80       ujis                                  EUC-JP Japanese
81       utf8                                  UTF-8 Unicode
82       utf16                                 UTF-16 Unicode
83       utf32                                 UTF-32 Unicode
84       utf8mb4                               UTF 4-byte Unicode
85
86   See also
87mysql_get_character_set_info(3)
88
89mysql_real_escape_string(3)
90
91
92
93Version 3.2.2                                       mysql_set_character_set(3)
Impressum