2

I've got a database that I want to export and import to another database on a different server, however after I've imported it I have character encoding issues i.e in some cases where there is a space in the html, a black diamond appears with a question mark inside.

I done the export a couple of months ago so can't remember if I simply imported the database via phpMyAdmin or used mysqldump! I'm going to re-import it today and wanted to know the best way to export and import. The HTML header on the website is utf-8, each database table has collation set to latin1_swedish_ci and the type is MyISAM.

The web server I am exporting from has the following settings:

MySQL charset: UTF-8 Unicode (utf8)

Apache/2.2.12 (Ubuntu) MySQL client version: 5.1.37 PHP extension: mysqli

PhpMyAdmin Version information: 3.2.2.1deb1

The web server I am importing to has the following settings:

MySQL charset: UTF-8 Unicode (utf8)

Apache MySQL client version: 5.5.24 PHP extension: mysqli

phpMyAdmin Version information: 3.4.10.1deb1

I would be grateful if someone can recommend the best way to export/import and if possible explain the reason behind the character encoding issues.

Thanks

Derek Carlisle
  • 485
  • 10
  • 27
  • [Refer here](http://stackoverflow.com/questions/4777900/how-to-display-utf-8-characters-in-phpmyadmin) – thar45 Oct 31 '12 at 10:36
  • Thanks. I've figured out that if I add mysql_query ("SET NAMES 'utf8'") before mysql_select_db then the odd characters disappear and the website looks fine. Is this a hack or is it safe to leave this in? The new database is going to be my new production database, therefore I need to ensure it won't affect anything. – Derek Carlisle Oct 31 '12 at 10:49

0 Answers0