views:

91

answers:

4

i have an old site whose database is in latin-1 encoding. i have created a drupal site duplicate of old site By default drupal database is in utf-8 encoding now how do i port the database from latin-1 to utf-8 . i tried myself and i get unwanted charachters . how should i do it.

+1  A: 

Here is the possible solution:

http://www.oreillynet.com/onlamp/blog/2006/01/turning_mysql_data_in_latin1_t.html

Hope that helps :)

Sarfraz
A: 

An easy manual way: export you database’s content e.g. with phpMyAdmin. Then create a UTF-8 coded empty text file, copy and paste the export file’s content, and then edit the table definitions to use UTF-8, if neccessery.

Joó Ádám
What the hell is an "UTF-8 coded emtpy text file"? If it's empty, what is its encoding supposed to be?
sleske
Have you ever heard of something like MIME types?…
Joó Ádám
+1  A: 
mysqldump ... | iconv -f ISO-8859-1 -t UTF-8 | mysql ...
just somebody
A: 

You can do it using a script done in another language, in Groovy for example you would do:

def utf8 = java.nio.charset.Charset.forName("UTF-8")
def latin1 = java.nio.charset.Charset.forName("ISO-8859-1") // this is latin1
def newString = new String(fetchStringFromDB().getBytes(latin1), utf8)
updateStringInDB(newString)
Jack
sleske