views:

52

answers:

2

I have a MYSQL database. Text is currently stored in charset latin1, collation latin1_swedish_ci. These are the defaults and it wasn't a problem back in the day when the database was originally created.

I want to switch over to UTF8 so the text encoding in the database matches out text encoding used elsewhere on the web site that uses the database.

My question is, what problems am I going to get when converting the data over and what should I be looking out for when I do. The majority of our text fits in plain acsii, but there are probably the occasional accented characters out there...

I think it would also be sensible to ask for any advice on the best way to go about changing the data.

+2  A: 

If you're converting from ASCII to UTF-8, I expect apart from some accented characters, you'll be fine. Going backwards is the problem, in my experience.

Randolph Potter
So mysql will take care of all the details, converting any accented characters to the appropriate utf8 encoding, leaving me with a table of correctly encoded utf8 characters?
rikh
In theory, yes. I've moved from ASCII to UTF on an inherited MySQL 4.x DB and it didn't appear to break anything.
Randolph Potter
A: 

Be attentive if you move data to other table. If the table encoding will be e.g. latin1 and you accidently put there raw UTF8 it will be a pain to recode it to the right encoding (if you do not have the source data ).

StarWind Software