rails - 2.3.8
ruby - 1.8.7
I really searched old questions but found nothing.
The deal is: Read from a .csv and update that info to my table in UTF8, but special chars like 'á','è','û' are changed for '?'.
My table supports all this kind of chars. here is the code i tryed:
FasterCSV.open("public/files/some.csv", :encoding => "U") do |csv|
csv.each do |line|
Model.update_all("column1 = '#{line}'", "id= 129476")
end
end
so line have thisÁcido acetilsalicílico;Ácido acetilsalicílico;Não Comercializado
on my terminal using debugger before the update to check, line have this:
�cido acetilsalic�lico;�cido acetilsalic�lico;N�o Comercializado
and on the table the content saved is: ?cido acetilsalic?lico;?cido acetilsalic?lico;N?o Comercializado
I did another test which consisted in read the file (line by line) and write a new file with each line read, before each write I checked the line on my terminal and it shown �cido acetilsalic�lico;�cido acetilsalic�lico;N�o Comercializado
.
But after all the file was written,when i opened that new file, surprise all the chars were well displayed how!!
I need help to understand why write in the database the chars are all stupid!!! xD