Community & Support

What´s up with Mysql 4.0 and UTF-8?

Hi there!

I´m trying to install 4.7 with mysql 4.0. I´ve been reading lot´s of posts about the utf-8 topic and still not sure if theres any solution. Right now drupal is working but the database tables are corrupted. Some spanish characters are stored as Á°, Á% but displayed correctly throw drupal.

¿Is there any procedure for making Drupal work saving the characters correctly in mysql 4.0?

Thanks
rlbravo

Comments

You may want to attach the

You may want to attach the BINARY attribute to all the varchar fields. Also, change all TEXT to BLOB.

But... those spanish characters occupy 2 bytes. So, for example, if you have a 20 bytes-wide field in your database, it can only store 10 spanish characters. And if there's some ASCII there too (spaces, commas), some chars will be choped! In other words, a huge headache.

Nothing wrong

MySQL 4.0 does not support UTF-8, but the characters are stored just fine as a byte-stream masquerading as Latin-1. You only need to pay attention when upgrading to MySQL 4.1, to export as Latin-1 from 4.0, then import as UTF-8 into 4.1.

--
If you have a problem, please search before posting a question.

--
If you have a problem, please search before posting a question.

thanks!

Great solution!
Thanks for your help!

rlbravo

how to export properly

I'm having exactly this problem in moving my database to a backup site running 4.1 from a live site running 4.0. Is there a flag for mysqldump i need to include? Something I need to do when importing via mysql?

Right now, some special characters get whacked when I try this, and I'd really appreciate help from someone who's gotten this to work. Thanks!

---
Work: Acquia

correct commands?

Ok, the below seems to work for me to move from 4.0 to 4.1 and doesn't mangle special characters as far as I can see.

to backup:

mysqldump -uusername -ppassword --add-drop-table --default-character-set=latin1 database > backup.sql

when restoring from the command line:

mysql -uusername -ppassword --default-character-set=utf8 database < backup.sql

---
Work: Acquia

Fix

mysql -uusername -ppassword --default-character-set=utf8 database < backup.sql

Worked for fixing drupal 4.7 to drupal 5 upgrade that introduced garbage characters.

nobody click here