I have a database full of data looking like this ΑντικαταβολΠand I need to find a way to convert it all into proper, utf8 data.
Is there a way to do it? The db is MySQL and is from an oscommerce merchant v2.2 installation.
I have a database full of data looking like this ΑντικαταβολΠand I need to find a way to convert it all into proper, utf8 data.
Is there a way to do it? The db is MySQL and is from an oscommerce merchant v2.2 installation.
2
Answers
First you need to figure out the original encoding, I suggest you get a text editor that allows “Load As (encoding)” like EmEditor, copy the text into a text file and open it as different encodings and see in which encoding it looks right. Then we can talk about how to convert that to UTF-8.
UPDATE: I just checked your dump file, copying a small portion of the weird looking text into a text file, saving as binary and reopening as UTF-8 shows up as proper Greek, have a php page like this:
see what you get.
First of all I’d try to identify what the character set of the data is. To do this:
SHOW CREATE TABLE
to find out the collation of the MySQL table that has the data inmysqldump
to a file on the serverNow you’ve got a copy of the data from the table that’s un-altered and byte for byte the same as what’s stored in the database. Using your favourite text editor try to switch character set encodings and work out what character set the data is stored in. When you eventually set the correct character set in your browser the text will render correctly.
Likely candidates for the encoding will be
ISO-8859-7
orUTF-8
.Once you’ve identified the correct encoding you should be able to modify the charset encoding in the mysqldump file and then load this data correctly into a new table.