Put Chinese, Korean, and other foreign text into MySQL database table

I was recently tasked with getting Korean & Chinese characters to go into a table of our MySQL database. The issue was the table we wanted to put foreign language text into a table that had a collation of latin1_swedish_ci which would cause question marks to appear in place of the foreign text. Additionally, this table already had 3000+ records in it.

To remedy this, I ran the following query on the table: 
ALTER TABLE `content_type_page` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

In our case the table was "content_type_page", so change that value to the table name you want to update.

As a precautionary measure, you should backup your database.

Keywords: Foreign language text into MySQL database


Submit a Comment