I'm trying to write a screen-scraper for a Rails app, scraping this page. Bit new to Rails, SQL and everything else really.
According to the W3C validator, the page I'm scraping is encoded as iso-8859-1. My database is Latin-1. Just to be sure, when I get the value I need, I save it as Latin1:
value = Iconv.iconv("latin1", "iso-8859-1", value)
However, when I run the scraper in rake, I get the following error:
rake aborted!
Mysql::Error: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=': SELECT * FROM `agencies` WHERE (`agencies`.`name` IN ('ZNA Middelheim - Queen Paola Children#s Hospital (Belgium)')) LIMIT 1
This is what MySQL says about the 'agencies' table - it looks to me like it's Latin-1:
--
-- Table structure for table `agencies`
--
DROP TABLE IF EXISTS `agencies`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `agencies` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) DEFAULT NULL,
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
So, what am I missing that is giving me this error? Where are the latin1_swedish_ci and utf8 in the error message coming from?
Thanks!