Problem encoding from csv to mysql

Hello,

I do have a problem with encoding from a (ANSI) csv file on a Windows
platform to a utf-8 encoded mysql table.

I get the following error: Mysql::Error: Incorrect string value:
‘\xE9basti…’ for column ‘display_name’ at row 1: UPDATE users SET
updated_at = ‘2010-04-03 13:27:21’, display_name = ‘S�bastien’ WHERE
id = 23
the character is an é (which is normal acsii code 130, but in this file
233.

I’m reading the file with fastercsv.
in the database the encoding is set to utf8.

I also tried some conversion with IConv like:

file_path = File.join(RAILS_ROOT,"import","#{file}.csv")
csv_data = Iconv.iconv('UTF-8','ASCII//TRANSLIT',file_path).to_s

(I tried ASCII//TRANSLIT, LATIN1, IBM367, ANSI_X3.4-1968, ASCII, and
more)
It looks like the encoding isn’t doing anything.

Ruby 1.8.7, Rails 2.3.5

Regards,
Henk.

Finaly found it, I had to use ‘MS-ANSI’ to encode from

Hope this may help you…
http://www.ronithomas.com/csv-to-mysql-converter/