List:General Discussion« Previous MessageNext Message »
From:Werner Van Belle Date:August 16 2010 7:46am
Subject:Re: Storage of UTF-8 char in MySQL
View as plain text  
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/



Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
Thread
Storage of UTF-8 char in MySQLRyan Chan14 Aug
  • Re: Storage of UTF-8 char in MySQLWerner Van Belle16 Aug
  • Re: Storage of UTF-8 char in MySQLJoerg Bruehe16 Aug