I am trying to use the Rake task to migrate some legacy data from MS Access to MySQL. I am working on Windows XP using Ruby 1.8.6.
I have an encoding for Rails set as "utf8" in database.yml .
In addition, the default character set for MySQL is utf8.
99% of the data comes in normally, but from time to time I get a column value that gives me an error something like this:
Mysql::Error: Incorrect string value: '\x92 Comm...' for column 'name' at row 1: INSERT INTO `organizations` ( [...] ) VALUES('Lawyers' Committee', [...] )
It seems that the problem associated with the MySQL problem is the apostrophe immediately after the "s" in the word "Lawyers".
Here is another one ...
Mysql::Error: Incorrect string value: '\x99 aoc' for column 'department' at row 1: INSERT INTO `addresses` [...] 'TRInfo™ aoc' [....]
It looks like he is choking on TM after TRInfo.
Is there any Ruby or Rails method with which I can run data to clear any characters that MySQL will choke on?
Ideally, it would be great to replace them with more pleasant characters - replace the apostrophe with one quote and the TM character with the string "(TM)".
Or, if I could somehow configure MySQL to store these characters as is without errors, that would be great too.
source share