I'm trying to convert a greek database to utf8. At this point, I've figured out how to do it (via MySQL, not through the iconv() function) but I have a problem: The application stores lots of data in the database in php serialized format (via serialize()).
As you may know, this format stores the string lengths in the serialized string. This means that since the lengths change after the conversion (because php5 doesn't support Unicode properly) those strings can't be unserialized anymore.
So far, I'm considering using one of the following approaches to work around this:
- Use PHP to convert those strings to utf8, and instead of converting the whole serialized string, unserialize it and convert every item in the array.
- Write a script to re-calculate the lengths of the serialized strings.
Option #2 seems easier, but I'm thinking there has to be a quicker way to do this. Maybe even a freely available script for converting them, since I'm definitely not the first one to face this problem. Any ideas?
Thanks in advance.