I a开发者_JS百科m 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: .
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. :-)
This worked for me...
Iconv.iconv('UTF-8','MS-ANSI',"your_text").to_s
精彩评论