• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

This article was migrated from http://rails.office.drecom.jp/hibi/archive/15

永久って書き方がすごいですが。

アプリを動かしてると、

"Illegal mix of collations
(latin1_swedish_ci,IMPLICIT) and
(sjis_japanese_ci,COERCIBLE) for operation '='"

みたいなエラーが出て。文字コードはUTF8とswedishなんたらだったけど。
したら、take another stepさんが対決してはった。
http://dream.ie.ariake-nct.ac.jp/~naoyuki/archives/000041.php

つまり、サーバとクライアントのコードが違うということらしいです。
ふむ。

mysqlのリファレンスを調べる。したらコレ。
http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html

SET NAMES 'x'

としたらいいらしい。
でもこれだとアプリで毎回しなくちゃいけないし。
大体rubyでどうするのかよくわからない。

そしたら!
先のmysqlのリファレンスのしたーーーのほうに
N Bernhardtさんがコメント。
--------------------------------------------------
Posted by N Bernhardt on August 17 2005 4:51pm

To change the connection charset permanently to UTF-8, add the following line in the [mysqld] section:
[mysqld]
init-connect='SET NAMES utf8'
--------------------------------------------------

で、/etc/mysql/my.cnfの[mysqld]のところにinit-…を追加しました。
show variables like 'character%';
show variables like 'collationr%';
してもやっぱり変数の値は変わってないですが、アプリを起動すると…
あら不思議!ちゃんと動きました!

(ただこれするとほかのアプリとかでUTF8にしたくないときも
UTF8になるので注意って書いてありました。なので注意です。)

とにかくやったーーー!
いやもうなんでも初心者で大変です。 http://rails.office.drecom.jp/hibi/archive/15

This article was migrated from http://rails.office.drecom.jp/hibi/archive/15

posted by Png satoko on Mon 5 Jun 2006 at 15:37

Search Words:

  • mix185 of183 illegal178 collations177 mysql82 and22 (sjis_japanese_ci,implicit)20 latin1_swedish_ci19 utf818 for18 operation18 collation16 (latin1_swedish_ci,coercible)12 (latin1_swedish_ci,implicit)12 sjis_japanese_ci10 redmine7 '='6 utf-86 rails6 文字化け5 接続5 illegal mix of collations5 (sjis_japanese_ci,coercible)4 my.cnf4 'like'4 like4 coercible3 文字コード3 set3 5.02 myql2 クライアント2 activerecord2 エラー2 ruby2 mysql2 query2 latin2 name2 to2 '2 implicit2 mysqld1 wordをmysqlへ1 1 in1 during1 error1 view1 utf8化1 names1 latin1_swedish_ci,implicit)1 mysql3butf81 lost1 connect1 illegal mix of collations (latin1_swedish_ci,implicit)1 11 sjis_japanese_ci,coercible1 utf1 20081 cmd1 (sjis_japanese_ci1 php1 latin1_swedish_ci,coercible1 sjis_japanese_ci,implicit)1 mysql51 postfix1 server1 (1 illeal1 sjis1 変更1 connection1 設定1 show variables like1 error:illegal1 --default-character-set=1 :1 sjis_japanese_ci,implicit1 mysqlの起動1 utf8接続1 postfixadmin1 コードページ1 'like1 illeagal1 dream1 air1 検索1

Comments:

or Preview
Tags
Social Bookmarks
  • Delicious
  • B_entry154
  • Clip_16_12_w154