How to import Chinese characters in Mysql Table?

H

I know proper way to do this does exists but I was falling short of time and wasnt able to find perfect solution, so used this a way around to import a list of chinese cities in chinese language to one of my mysql table.

1. 1st changed the table structure to make the city field collation as big5_chinese_ci

2. I had the list of chinese cities in chinese language in excel sheet. Using a small VBA below code, i created mysql insert into query for each of the record:

Sub CreateQueries()
      r1 = 1
      While Range(“A” & r1) <> “”
           Range(“C” & r1) = “insert into cities values(‘” & Range(“A” & r1) & “‘);”

        r1 = r1 + 1
      Wend
End Sub

3. Then just copy pasted all these generated queries in mysql SQL window and executed the queries and I had proper characters in mysql table 🙂

Initially, I tried to export excel to csv and then importing it in mysql, but it was showing ???? symbols in mysql after import. So this turned out to be cool quick solution. Hope it can help somebody solve similar problem I was facing.

About the author

Nishant Bamb
By Nishant Bamb

Category