0

First I import my csv file into mysql database. After the data load into mysql table, I clicked "Apply" to apply sql script to the database. But I keep getting this error saying I have the incorrect string value in my 'comment' column. My data type for "comment" is varchar(500).

Here is an example of the error shown:

Error 1366: 1366: Incorrect string value: '\x92Ambre...' for column "Content" at row 1 SQL Statement:

INSERT INTO data.hermes (Hermes_Id, PostDate, ChannelCountry, Content)VALUES('1', '10-Feb-15', 'US', 'I Prefer the scent of \nHermes L?Ambre des Merveillies, but the performance/sillage of \nHermes Elixir des Merveillies ? is better.')

Error 1366: 1366: Incorrect string value: '\xAOIT%#...' for column "Content" at row 1 SQL Statement:

INSERT INTO data.hermes (Hermes_Id, PostDate, ChannelCountry, Content)VALUES('2', '10-Feb-15', 'US', 'Hermes L?Ambre des Merveilles \nYummy!!!!!! ? It's on my wish list.? Go for it! ')

etc.... etc...

P/s: the data type for my "PostDate" is varchar(30).

Someone please help me out. Thanks.

1 Answers1

0

your csv file probably have a different charset than your mysql server, try to use iconv on your csv file, for example to convert it from windows charset to utf8 charset, then try to import again

something like :

$ iconv -f ISO-8859-1 -t UTF-8 < input.txt > output.txt

more on conv : http://ss64.com/bash/iconv.html

see also Windows-1252 to UTF-8 encoding

( assuming your csv file is windows only charset windows-1252 , perhaps you need different conversion options )

Community
  • 1
  • 1
neofutur
  • 387
  • 5
  • 13