I'm having a big problem with mysql and drupal, hope you can help me...
My drupal 4.7 website is hosted on a linux RH box (not mine: Atjeu.com). Drupal was installed upon mysql 4.0.27 and utf8 was the encoding.
The server has been rebuilt because it has been heavily hacked, and the technicians have fully restored the backups.
Restoring the server, the ISP upgraded mysql to 4.1.x; actually I don't know if this is the real culprit, but my web pages scambled all accented letters. I opened the database with phpmyadmin and saw that every table had a latin1 charset and swedish_general_ci collation, instead of ut8_general_ci
The ISP doesn't seem to be able to fix the issue, I opened a support ticket three days ago! I need your help!
It seems that the db actually has utf8 data in it, but for some reason it reads it as latin1.
I have already tried to:
1) alter the tables and change them to utf8 and utf8_general_ci
to no avail, all accenter letters were still garbled on my web pages
2) follow the directions on http://textsnippets.com/posts/show/84 :
# mysqldump --user=usr --password=passwd --default-character-set=latin1 --skip-set-charset mysql_db > mysql_db.sql
# sed -r 's/latin1/utf8/g' ./mysql_db.sql > mysql_db_utf8.sql
# mysql --user=usr --password=passwd --execute="DROP DATABASE mysql_db; CREATE DATABASE mysql_db CHARACTER SET utf8 COLLATE utf8_general_ci;"
# mysql --user=usr --password=passwd --default-character-set=utf8 mysql_db < mysql_db_utf8.sql
But this last command retuened with:
ERROR 1062 (23000) at line 1406: Duplicate entry 'perchè' for key 1
I'm getting frustrated… anyone can help me?? :-(
Comments
Run this php script against your database
I can't remember exactly where I found this so I don't have a link, but I've successfully used it several times.
Thanks for your time, but it
Thanks for your time, but it didn't work.
The script changed the table charset to utf8 and collationto utf8_general_ci
but mysql still interprets utf8 data as latin1
:-(
I've just had same problem
My hoster had upgraded MySQL from 4.0.26 to 5.0.x and my Drupal's sites (Drupal 4.7, 5.0) were changed encoding. Opened with PHPmyAdmin databases had charset cp1251 instead utf8. It was very unplesent.
I made dump of database and used editor Vi in Shell. I wrote :$s/ DEFAULT CHARSET=cp1251/ DEFAULT CHARSET=utf8/g