1
<?xml version='1.0' encoding='UTF-8'?>
2
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3
"docbook/dtd/xml/4.2/docbookx.dtd" [
4
<!ENTITY % global_ents SYSTEM "../global.ent">
7
<refentry id="functions.mysql_set_character_set" display-name="0">
9
<refentrytitle>mysql_set_character_set</refentrytitle>
12
<refname>mysql_set_character_set</refname>
13
<refpurpose>Sets the default client character set@</refpurpose>
15
<refsect1 role="description">
18
<methodname>mysql_set_character_set</methodname>
19
<methodparam><type>MYSQL *</type><parameter>mysql</parameter></methodparam>
20
<methodparam><type>const char *</type><parameter>csname</parameter></methodparam>
23
<para>Sets the default character set for the current connection</para>
25
<refsect1 role="parameters">
26
<title>Parameters</title>
28
<varlistentry><term><parameter>mysql</parameter></term><listitem><para>¶m.mysql;</para></listitem></varlistentry>
29
<varlistentry><term><parameter>csname</parameter></term><listitem><para>Character set name</para></listitem></varlistentry>
32
<refsect1 role="returnvalue">
33
<title>Return value</title>
34
<para>Returns zero on success, non-zero on failure.</para>
36
<refsect1 role="notes">
39
<para>It's strongly recommended to use <function>mysql_set_character_set()</function> instead of <command>SET NAMES ...</command> since <function>mysql_real_escape_string()</function> might fail or deliver unexpected results.</para>
40
<para>The client library supports the following character sets:</para>
41
<simplelist type="horiz" columns="2">
42
<member>armscii8</member><member>8 bit character set for Armenian</member>
43
<member>ascii</member><member>US ASCII character set</member>
44
<member>big5</member><member>2 byte character set for traditional Chinese, Hongkong, Macau and Taiwan</member>
45
<member>binary</member><member>8 bit binary character set</member>
46
<member>cp1250</member><member>Windows code page 1250 character set</member>
47
<member>cp1251</member><member>Windows code page 1251 character set</member>
48
<member>cp1256</member><member>Windows code page 1256 character set</member>
49
<member>cp1257</member><member>Windows code page 1257 character set</member>
50
<member>cp850</member><member>MS-DOS Codepage 850 (Western Europe)</member>
51
<member>cp852</member><member>MS-DOS Codepage 852 (Middle Europe)</member>
52
<member>cp866</member><member>MS-DOS Codepage 866 (Russian)</member>
53
<member>cp932</member><member>Microsoft Codepage 932 (Extension to sjis)</member>
54
<member>dec8</member><member>DEC West European</member>
55
<member>eucjpms</member><member>UJIS for Windows Japanese</member>
56
<member>euckr</member><member>EUC KR-Korean</member>
57
<member>filename</member><member></member>
58
<member>gb2312</member><member>GB-2312 simplified Chinese</member>
59
<member>gbk</member><member>GBK simplified Chinese</member>
60
<member>geostd8</member><member>GEOSTD8 Georgian</member>
61
<member>greek</member><member>ISO 8859-7 Greek</member>
62
<member>hebrew</member><member>ISO 8859-8 Hebrew</member>
63
<member>hp8</member><member>HP West European</member>
64
<member>keybcs2</member><member>DOS Kamenicky Czech-Slovak</member>
65
<member>koi8r</member><member>KOI8-R Relcom Russian</member>
66
<member>koi8u</member><member>KOI8-U Ukrainian</member>
67
<member>latin1</member><member>CP1252 Western European</member>
68
<member>latin2</member><member>ISO 8859-2 Central Europe</member>
69
<member>latin5</member><member>ISO 8859-9 Turkish</member>
70
<member>latin7</member><member>ISO 8859-13 Baltic</member>
71
<member>macce</member><member>MAC Central European</member>
72
<member>macroman</member><member>MAC Western European</member>
73
<member>sjis</member><member>SJIS for Windows Japanese</member>
74
<member>swe7</member><member>7-bit Swedish</member>
75
<member>tis620</member><member>TIS620 Thai</member>
76
<member>ucs2</member><member>UCS-2 Unicode</member>
77
<member>ujis</member><member>EUC-JP Japanese</member>
78
<member>utf8</member><member>UTF-8 Unicode</member>
79
<member>utf16</member><member>UTF-16 Unicode</member>
80
<member>utf32</member><member>UTF-32 Unicode</member>
84
<refsect1 role="seealso">
85
<title>See also</title>
86
<para><function>mysql_real_escape_string()</function></para>