开发者

RefineryCMS: Illegal mix of collations

开发者 https://www.devze.com 2023-03-29 07:44 出处:网络
I am working on a refinerycms instance that is supposed to utilize the i18n technology, but I keep getting the following error when saving out a page in Russian:

I am working on a refinerycms instance that is supposed to utilize the i18n technology, but I keep getting the following error when saving out a page in Russian:

ActiveRecord::StatementInvalid in Admin::PagesController#update

Mysql2::Error: Illegal mix of collations (latin1_swedish_ci,IMPLICIT) and (utf8_general_ci,COERCIBLE) for operation '=': SELECT COUNT(*) FROM `slugs` WHERE `slugs`.`name` = 'Ñтраница-не-найдена' AND `slugs`.`scope` IS NULL AND `slugs`.`locale` = 'ru' AN开发者_开发知识库D (`slugs`.sluggable_id = 2 AND `slugs`.sluggable_type = 'Page')

any ideas on why this happening? In my database.yml I have set the encoding to be utf8


It is likely that your database itself is set to latin1 or that the slugs table is set to latin1 or that one of the columns in the slugs table is set to latin1... don't you just love MySQL?

database.yml is only for the adapter, it doesn't change the database. Go into the dbconsole, then:

To check the database settings:
SHOW VARIABLES LIKE 'char%';
SHOW VARIABLES LIKE 'collation%';

To check the table settings: SHOW CREATE TABLE tablename;

To check the individual columns: SHOW FULL COLUMNS IN tablename;

If you created a database with the wrong encoding, you will have to change every single occurence of latin1 in all of these.

0

精彩评论

暂无评论...
验证码 换一张
取 消