2

I am lost on this. I have a web site that I work on offline, then I upload to live server, import MySQL database to live server, and make live in general. Problem is that when I export database from LIVE server and import back into LOCAL server, I get unknown characters in my XHTML output, the black diamond with the white question mark in the middle, you know the one.

The command I used to export my database from LOCAL MySQL installation is as follows:

mysqldump --verbose -hlocalhost -uxxx -pxxx --databases xxx --add-drop-table --default-character-set UTF8 > somedir/xxx.sql

Then, when importing that data to the LIVE database I used a simple command as follows:

mysql -hlocalhost -uxxx -pxxx somedatabase < xxx.sql

Great, all is well, data is imported and there are NO unknown characters on site. However, when I do the same in reverse (dump on live server using same command as in windows, import in windows using same mysql command) that is when all the unknown characters appear.

Is it a collation issue? Am I using the incorrect --default-character-set ?

I have never had this happen before, and I would love some feedback or a nudge in the right direction.


UPDATE: I have completely dropped my local one, exported the ENTIRE live db and imported. Still the same error :/ This is driving me mad!


Many thanks, Simon

3
  • "collation" is not character encoding. Collation just says that b comes after a, it does not affect how characters are shown. Commented Mar 31, 2011 at 10:51
  • Thanks, I did not know that. What is a good default collation to use then for a standard web site, English Joomla web site in this case. Commented Mar 31, 2011 at 11:01
  • The default (Swedish) collation is fine for English text. Commented Mar 31, 2011 at 11:55

2 Answers 2

1

Try on both sides:

SET names UTF-8

Probably the defaults differ.

Sign up to request clarification or add additional context in comments.

9 Comments

@vbence will I run this command inline with the import command or where and when?
@webfac Yes, if your file is UTF-8, you should run this command in the same connection (insert it as the first line of your SQL dump). Also you have to do this every time you connect to the database if it is not the default. - Of course I assume here that you use UTF-8 on your development macine.
@vbence - It is a Joomla database, and I do not know what it installs as. But let me give that a go and see if it clears the air. Thank you.
I really do not know what is up. I tried dumping as utf8 and latin1, I even dropped the local database and imported an entire new database, but still these characters appear??
Have you tried using --default-character-set UTF8 with your IMPORT commadn too?
|
0

I suspect your live site has a different database schema, could it be latin1?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.