Page 1 of 1

[SOLVED] strange weird characters showing up after a db dump

Posted: Thu Feb 03, 2005 11:29 am
by Burrito
I just dumped my database from one machine to another...(I set up mysql identically on both) and when I imported my data to the new machine and hit the site (from the new machine...I have several weird chars showing up).

ie: Let’s was supposed to be Let's...I. there are several others that are showing up the same way.

I'm assuming that they are "reserved" chars like the " ' " and " \ " etc but I've never had this happen before.

I dumped the db from phpMyAdmin and inserted it using mysql from the command line.

any ideas here?

Posted: Thu Feb 03, 2005 11:33 am
by Burrito
I just looked at the sql file and it has Let's ( the way it should be ) so it's dying on my data import.

is there a switch or something I can use to make it escape those chars?

Posted: Thu Feb 03, 2005 11:38 am
by feyd
it sounds more like a character encoding mismatch issue.

Check the phpMyAdmin dump to make sure they are correct (it should look like '')

if these were copied in from Word, for instance, they are likely binary data and as such are screwy and should be converted to usable entities or characters.

Posted: Thu Feb 03, 2005 11:47 am
by Burrito
ok I found my problem.

instead of having "let''s learn about them" or "let''s learn about them" I have: "Let’s learn about them"

the funky single quote... it might be as you suspected feyd in that it came from word with some strange char. My question then becomes, can I convert my .sql file to some other format that will import all of those correctly?

I really can't do a find and replace of all of those because I'm not even sure of what all the chars are that are having problems.

Posted: Thu Feb 03, 2005 11:58 am
by feyd
changing the character set output by the server can hide it, however they will still be binary characters (unless you run them through htmlentities or its siblings.) Also, switching character sets may only work for one country.. so it's best to hunt them all down.. and slap the person that pasted directly from Word :P

Posted: Thu Feb 03, 2005 1:07 pm
by Burrito
finally got this figured out.

I ended up dumping from phpmyadmin to a .sql file.

I then opened my .sql file with notepad and did a replace of all the defaultcharset=latin1 with defaultcharset=utf8.

I then *tried* to do my import from the mysql command line but saving it out from notepad made the thing bomb on the first line.

Soooo, I had to copy and paste all of the creates, inserts etc from my notepad to phpmyadmin (on the new machine) and it worked great.

thx for the help Feyd,

Burr