10.1.10 Unicode Support

ucs2, the UCS-2 encoding of the Unicode
character set using 16 bits per character.

utf8, a UTF-8 encoding of the Unicode
character set using one to three bytes per character.

These two character sets support the characters from the Basic
Multilingual Plane (BMP) of Unicode Version 3.0. BMP characters
have these characteristics:

Their code values are between 0 and 65535 (or
U+0000 .. U+FFFF).

They can be encoded with a fixed 16-bit word, as in
ucs2.

They can be encoded with 8, 16, or 24 bits, as in
utf8.

They are sufficient for almost all characters in major
languages.

The ucs2 and utf8
character sets do not support supplementary characters that lie
outside the BMP. Characters outside the BMP compare as
REPLACEMENT CHARACTER and convert to '?' when
converted to a Unicode character set.

A similar set of collations is available for each Unicode
character set. For example, each has a Danish collation, the
names of which are ucs2_danish_ci and
utf8_danish_ci. All Unicode collations are
listed at Section 10.1.13.1, “Unicode Character Sets”.

The MySQL implementation of UCS-2 stores characters in
big-endian byte order and does not use a byte order mark (BOM)
at the beginning of values. Other database systems might use
little-endian byte order or a BOM. In such cases, conversion of
values will need to be performed when transferring data between
those systems and MySQL.

MySQL uses no BOM for UTF-8 values.

Client applications that need to communicate with the server
using Unicode should set the client character set accordingly;
for example, by issuing a SET NAMES 'utf8'
statement. ucs2 cannot be used as a client
character set, which means that it does not work for
SET NAMES or SET CHARACTER
SET. (See Section 10.1.4, “Connection Character Sets and Collations”.)

The following sections provide additional detail on the Unicode
character sets in MySQL.

if you get data via php from your mysql-db (everything utf-8) but still get '?' for some special characters in your browser (<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />), try this: