views:

26

answers:

2

I am inserting data from CSV to database.

While i am trying to insert this row

2 créditos,,,,R,75,, 

into my database i am getting this error Mysql::Error: Incorrect string value: '\xE9ditos...' for column 'message' at row 1: .

+2  A: 

Chances are the data in the CSV files is in "Windows-1252" format (especially if it's sourced via Excel).

I'm afraid I don't know Ruby/Rails that well, but hopefully this code snippet should help. :-)

middaparka
A: 

This worked for me...

Iconv.iconv('UTF-8','MS-ANSI',"your_text").to_s 
krunal shah