Created
August 14, 2014 20:08
-
-
Save fernandoaleman/76ae43ef54f32aa6cf4d to your computer and use it in GitHub Desktop.
Converting MySQL Database Contents to UTF-8
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# First create a dump of your MySQL database | |
mysqldump -u [user] -p database_name > database_name.sql | |
# Convert the data | |
iconv -f iso-8859-15 -t utf8 database_name.sql > database_name_iconv.sql | |
# Import the database | |
mysql -u [user] -p database_name < database_name_iconv.sql | |
# If you still have some specific characters that do not display | |
# correctly, you can update them individually. | |
# This is an example of updating a single quote | |
UPDATE `table_name` SET `column_name` = REPLACE(column_name, 'â', '’'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment