Oracle 5.0 Reference Manual page 2918

Table of Contents

Advertisement

MySQL 5.0 FAQ: MySQL Chinese, Japanese, and Korean Character Sets
We encourage the use of the newer
previous example could be rewritten as shown here:
<?php
$link = new mysqli($host, $usr, $pwd, $db);
if( mysqli_connect_errno() )
{
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$link->query("SET NAMES 'utf8'");
?>
Another issue often encountered in PHP applications has to do with assumptions made by the
browser. Sometimes adding or changing a
to insure that the user agent interprets page content as UTF-8, you should include
equiv="Content-Type" content="text/html; charset=utf-8">
HTML page.
If you are using Connector/J, see
B.11.11: I've upgraded to MySQL 5.0. How can I revert to behavior like that in MySQL 4.0 with
regard to character sets?
In MySQL Version 4.0, there was a single "global" character set for both server and client, and the
decision as to which character to use was made by the server administrator. This changed starting with
MySQL Version 4.1. What happens now is a "handshake", as described in
Character Sets and
Collations":
When a client connects, it sends to the server the name of the character set that it
wants to use. The server uses the name to set the
character_set_results
variables. In effect, the server performs a
set name.
The effect of this is that you cannot control the client character set by starting
character-set-server=utf8
prefer the MySQL 4.0 behavior. To make it possible to retain this behavior, we added a
--character-set-client-handshake
set-client-handshake
[402], then, when a client connects, it sends to the server the name of the character set
handshake
that it wants to use—however, the server ignores this request from the client.
By way of example, suppose that your favorite server character set is
but this is the default value). Suppose further that the client uses
operating system supports. Now, start the server with
mysqld --character-set-server=latin1
And then start the client with the default character set utf8:
mysql --default-character-set=utf8
The current settings can be seen by viewing the output of
mysql>
SHOW VARIABLES LIKE 'char%';
+--------------------------+----------------------------------------+
| Variable_name
+--------------------------+----------------------------------------+
| character_set_client
| character_set_connection | utf8
| character_set_database
| character_set_filesystem | binary
extension, rather than mysql. Using mysqli, the
mysqli
<meta>
Section 20.3.5.4, "Using Character Sets and
[443], and
character_set_connection
SET NAMES
[403]. However, some of our Asian customers have said that they
[402], which can be turned off with
[402]. If you start
mysqld
| Value
| utf8
| latin1
2898
tag suffices to correct the problem: for example,
character_set_client
operation using the character
with
--skip-character-set-client-
latin1
because this is what the client's
utf8
as its default character set:
latin1
SHOW
VARIABLES:
|
|
|
|
|
<meta http-
in the
of the
<head>
Unicode".
Section 10.1.4, "Connection
[441],
[442]
system
with
mysqld
--
switch,
mysqld
--skip-character-
(unlikely in a CJK area,

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents