Converting Database From LATIN-1 to UTF-8

Hi there,

I have an older database that is still using LATIN-1 as its encoding and I’d like to switch this to UTF-8 for the database, its tables, and their columns.

Would these queries do the trick?

alter table TABLENAME convert to CHARACTER SET utf8 COLLATE utf8_unicode_ci;
[each table...]
[each table...]
[each table...]
alter database SCHEMA default character set utf8 COLLATE utf8_unicode_ci;

My questions are:

[list][*]Do I need to worry about any data/character loss upon conversion of these tables? Or will the conversion be clean?

[*]What about columns that are currently storing HTML data? This data has been htmlspecialchar()'ed in PHP.[/list]Furthermore, as I have been looking into encoding issues for this web app, I discovered that Apache’s AddDefaultCharset has been set to ISO-8859-1 since the web app’s inception. So, any data that has been submitted to this database via web forms has had an encoding of ISO-8859-1. This has now been set to UTF-8.

In summary: web pages accepting ISO-8859-1 encoding into a LATIN-1 database switching to UTF-8 all around.

Just want to make sure I don’t lose any data before the flip. :slight_smile: What do I need to be aware of?

Thanks in advanced.