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

rlbravo - June 28, 2006 - 20:15

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

You may want to attach the

amnon - June 28, 2006 - 22:14

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

Steven - June 29, 2006 - 00:02

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.

thanks!

rlbravo - June 29, 2006 - 01:13

Great solution!
Thanks for your help!

rlbravo

how to export properly

pwolanin - June 29, 2006 - 01:18

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!

correct commands?

pwolanin - July 2, 2006 - 15:01

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

Upgrade 4.6 MySQL DBs with UTF8 data to 4.7 - this worked!

levavie - November 16, 2006 - 16:04

Follow this tip: http://drupal.org/node/84214
After a long search, it's the only thing which worked for me.

Amnon
-
Drupal Focused Search Engine | Drupal Israel | Organic Web Strategy Consulting

Fix

glass.dimly - August 22, 2009 - 20:21

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

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

 
 

Drupal is a registered trademark of Dries Buytaert.