Web Development Blog

by Ei Sabai Nyo

07 Jun, 2008

Utf-8 encoding problem with MySQL restore    

To resolve Utf-8 encoding problem that you experience when you restore a MySQL database, here is a quick and easy fix.

You will first need to make sure that appropriate encoding/collation (eg: utf8_bin, latin1_swedish_ci, etc) is being used for your database and tables before you attempt the following steps.

1. Open your MySQL dump file in a text editor (eg: Notepad++)
2. Add <meta http-equiv="content-type" content="text/html;charset=utf-8"> at the beginning of the file
3. Save the file as “mysqldump.html”
4. Open mysqldump.html in a web browser (I use Firefox)
5. View source of the file (Shortcut in Firefox: Ctrl+U), and copy the entire content except for the first line <meta http-equiv="content-type" content="text/html;charset=utf-8">
6. Paste it into MySQL query window of your new database (You can use phpMyAdmin’s Query Window) and run the queries

Technorati Tags: , , , , ,

Love what you've just read? Subscribe to our newsletter to receive tips, resources and special offers related to web development & design.
Your name:   Your email:  

One Response to “Utf-8 encoding problem with MySQL restore”

  1. Yogesh Kumbhar says:

    Thanks a lot
    this works fine on my Indian (Devnagari) fonts also.
    but I have some doubts
    How could I use this for mysql source command or Restore option for Mysql Administrator Tool

Profile PicHello! Welcome to Web development blog! My name is Ei Sabai and on this blog, I write about web development, mobile app development, latest web technologies and the likes. Read more about me or have a look at some of the tips & resources I've written.
Subscribe to our newsletter to receive tips, resources and special offers related to web development & design.
We do NOT spam.
Your name:  
Your email:  

Tips & Resources

Tips & Resources
WordPress Web Hosting
Recommended web hosting providers for WordPress 3.0
iPhone Native App Development
Important steps into iPhone app development for beginners
iPhone Web App Development
Tips for iPhone web app development
Coupons for Web Developers
Get discounts on web hosting, domain names, templates, etc
10 Useful jQuery Snippets
Easy-to-use jQuery snippets for any website
HTML Email Newsletter
Step-by-step tutorial on how to code an HTML email newsletter
  • bluehost Hosting $6.95/month
  • Joomla Templates

Recommended Book

Categories