Rakefile help

Hello all,

I’m hoping someone can help me out here.

I haven’t got my application online so will explain as best as I can.

I have written a rake task to import specific data from a CSV file into my database.

It was working perfectly, however I was tweaking the .numbers file (which I then export out to CSV using UTF-8 encoding) and I changed the word “Disneys” to “Disney’s” to make it correct.

However, the rakefile keeps choking on the quote.

It seems like it’s has incorrectly identified the encoding type of the CSV file.

The error I receive is something along the lines of:

Encoding::UndefinedConversionError: “\xE2” from ASCII-8BIT to UTF-8: INSERT INTO “parks” (“city”, “country”, “created_at”, “lat”, “lng”, “name”, “region”, “updated_at”) VALUES (?, ?, ?, ?, ?, ?, ?, ?

What confuses me is that I have other locations in my file where I have used quotes and it doesn’t choke on those but if I remove one of those passing quotes and re-insert a new quote, it starts to choke on the new one as well.

I have tried adding # coding: utf-8 to the top of the rakefile but that doesn’t solve the issue.

Anyone have any ideas?

Thankyou

Regards,
Neil

Anyone?

Since you indicated you changed the quote mark, I suspect the others (that were not offending RAKE) actually have “ticks” and not single quotes. The difference is so subtle it is difficult to detect visually.

Appreciate the reply.

I did eventually manage to get this solved. I disabled Magic Quotes in Pages preferences and then did a find and replace to put proper quotes in, all works perfectly now.

Thanks once again though.

Regards,
Neil