NYCPHP Meetup

NYPHP.org

[nycphp-talk] utf-8, iso-8859-1...

Chris Snyder chsnyder at gmail.com
Thu May 6 12:59:31 EDT 2010


On Thu, May 6, 2010 at 12:26 PM, Anthony Wlodarski
<oneofthosed3afmutes at yahoo.com> wrote:
> I second, full UTF-8 is awesome down the line for internationalization.
>  First see if MySQL even supports UTF-8 on your system, execute: "SHOW
> CHARACTER SET;" and utf8 should appear in the list.  Then "ALTER TABLE
> tbl_name CONVERT TO CHARACTER SET charset_name COLLATION collation_name;".
>  Since I have not done this myself I can't verify that it will rebuild
> indexes on the table, I don't think it should but might want to look into
> that as rebuilding indexes on a large table could be time consuming.

Dirty secret - MySQL latin-1 tables will happily store and retrieve
utf-8 data. They won't sort it correctly, though I believe they will
sort it consistently.

So even if your MySQL was compiled without unicode support, you can
put utf-8 in and get utf-8 out.

Of course, if you're going to take the trouble to convert, you should
do it right.



More information about the talk mailing list