开发者

Mysql::Error: Incorrect string value: '\xE9ditos...' with rails

开发者 https://www.devze.com 2023-01-10 15:07 出处:网络
I a开发者_JS百科m inserting data from CSV to database. While i am trying to insert this row 2 créditos,,,,R,75,,

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 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号