Neelabh Singh
Neelabh Singh

Reputation: 2678

How to recreate issue: Mysql2::Error: Illegal mix of collations (latin1_swedish_ci,IMPLICIT)

Can anyone suggest how to recreate issue Mysql2::Error: Illegal mix of collations (latin1_swedish_ci,IMPLICIT)

This was triggered due API /admin/products and "action"=>"index".

Error:

/admin/products#GET params: { "controller"=>"admin/products"}, 
exception: ActiveRecord::StatementInvalid, message: Mysql2::Error:
 Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and 
(utf8_general_ci,COERCIBLE) for operation 'like'

Upvotes: 0

Views: 345

Answers (1)

Mark
Mark

Reputation: 6455

You're using the wrong character set. Try using UTF-8, add the following at the top of your offending file:

#!/bin/env ruby
# encoding: utf-8

Upvotes: 1

Related Questions