Re: Storage of UTF-8 char in MySQL

2010-08-16 Thread Werner Van Belle
Ryan Chan wrote:
 According to this document:
 http://dev.mysql.com/doc/refman/5.0/en/charset-unicode.html

 It said MySQL support UTF-8 using one to three bytes per character.

 But I have created a test table:

 -- create table test ( c char(5) ) default charset =utf8;

 From the table status, the data length is alway a multiple of 16.

 So how does it support 3 byte UTF-8 in practice?
   
I'm afraid you might need to read up on UTF8 and unicode in general.
It's not a 'choice' to have 1, 2 or 3 bytes per character. Rather, when
the characters is sufficiently weird then UTF8 will use 2 or 3 bytes for
that specific character only. Only if your entire message is weird, will
each character consume 3 bytes.

Wkr,

Werner,-

-- 
http://werner.yellowcouch.org/




signature.asc
Description: OpenPGP digital signature


Re: Storage of UTF-8 char in MySQL

2010-08-16 Thread Joerg Bruehe
Ryan,, all:


Ryan Chan wrote:
 According to this document:
 http://dev.mysql.com/doc/refman/5.0/en/charset-unicode.html
 
 It said MySQL support UTF-8 using one to three bytes per character.
 
 But I have created a test table:
 
 -- create table test ( c char(5) ) default charset =utf8;
 
 From the table status, the data length is alway a multiple of 16.

When you have a question about any software behavior (not limited to
MySQL), you really should specify the version and the platform.

No, we won't guess.


Jörg

-- 
Joerg Bruehe,  MySQL Build Team,  joerg.bru...@oracle.com
ORACLE Deutschland B.V.  Co. KG,   Komturstrasse 18a,   D-12099 Berlin
Geschaeftsfuehrer: Juergen Kunz, Marcel v.d. Molen, Alexander v.d. Ven
Amtsgericht Muenchen: HRA 95603


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org



Storage of UTF-8 char in MySQL

2010-08-14 Thread Ryan Chan
According to this document:
http://dev.mysql.com/doc/refman/5.0/en/charset-unicode.html

It said MySQL support UTF-8 using one to three bytes per character.

But I have created a test table:

-- create table test ( c char(5) ) default charset =utf8;

From the table status, the data length is alway a multiple of 16.

So how does it support 3 byte UTF-8 in practice?


Thanks

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org