Forum: Rails deployment problem encoding from csv to mysql

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
090189529a13fddfd5b8763abef1750e?d=identicon&s=25 Henk S. (salautom)
on 2010-04-03 19:52

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

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
It looks like the encoding isn't doing anything.

Ruby 1.8.7, Rails 2.3.5

090189529a13fddfd5b8763abef1750e?d=identicon&s=25 Henk S. (salautom)
on 2010-04-20 12:28
Finaly found it, I had to use 'MS-ANSI' to encode from
764d92c910bde65dad85187e9e9e7219?d=identicon&s=25 Anoop R. (ronipthomas)
on 2010-11-23 22:00
This topic is locked and can not be replied to.