frei

旧「anney's room」からブログ「frei」だけ引っ越し&残しました

文字化けの嵐。

数日前、会社で同僚さん達と都内某所の

ちょいと洒落た場所でお昼を食べていたところ。

同僚さんの携帯に届いた、私ん所のSNSのデイリーニュースが

文字化けの嵐となっていたのでした。

・・・はっ。

昨日は確か、SNS置いてる

ドイツのサーバーのメンテだったはず。

またかよ、ドイツ。やってくれるぜ、ドイツっ。

一体何が起きたんだ?

かくして、速攻で対応したいのは山々なのだけど、

仕事がそれなりに忙しかったりなんかして、

結構、最近帰るとクタクタで、何もしたくなかったり。

だけど、一応、仲間がSNS使ってくれているので

何とか復旧を試みるも、

phpMyAdmin でDBのデータを見た時点で

日本語が全て文字化け…orz

検索してみると、なにやら mysqlのバージョン次第で

文字コードについて、いろいろ設定に気をつけなアカン箇所が出てくるとかで

あっちこっちのテーブルそれぞれに、文字コード設定するハメになりそうな予感。

・・・プツン。(PCの電源を落とす)

おやすみなさい。

かくして、放置プレイだった訳ですが、

土曜日なので、重い腰をあげて問題に取り組んでみた次第。

そこで、ふと視点を変えて、SNSOpenPNEじゃなくて

普通にphpの関数使って、DB接続したらどうなるんだろう?…と

単純なテストコード書いてみたら・・・文字化けしないでやんの。

結論:OpenPNE中の、phpソースのどっかで余計な事をしているらしい?

仕方ないので、あっちこっちに

デバッグ用の文字列を書き込んで吐いてみたところ

見つかったのは、この1行。

webapp/lib/OpenPNE/DB.php:58行目

$this->db->query('SET NAMES utf8');

だーっ。これだー。

そんな訳で、この1行をコメントアウトしたら文字化け直りました。

とは言え、SNS以外の、とある物はまだ文字化け中。

はぁ、まだ対応しなくっちゃ。

ちなみに、現在の mysql のサーバー変数は以下の通り。

サーバ変数と設定値

変数 セッション値 / グローバル値

back log 50

basedir /usr/

binlog cache size 32,768

bulk insert buffer size 8,388,608

character set client utf8

(グローバル値) latin1

character set connection utf8

(グローバル値) latin1

character set database latin1

character set results utf8

(グローバル値) latin1

character set server latin1

character set system utf8

character sets dir /usr/share/mysql/charsets/

collation connection utf8_general_ci

(グローバル値) latin1_swedish_ci

collation database latin1_swedish_ci

collation server latin1_swedish_ci

concurrent insert ON

connect timeout 5

datadir /home/mysql/

date format %Y-%m-%d

datetime format %Y-%m-%d %H:%i:%s

default week format 0

delay key write ON

delayed insert limit 100

delayed insert timeout 300

delayed queue size 1,000

expire logs days 0

flush OFF

flush time 0

ft boolean syntax + -><()~*:""&|

ft max word len 84

ft min word len 4

ft query expansion limit 20

ft stopword file (built-in)

group concat max len 1,024

have archive YES

have bdb NO

have blackhole engine NO

have compress YES

have crypt YES

have csv YES

have example engine NO

have geometry YES

have innodb DISABLED

have isam YES

have ndbcluster DISABLED

have openssl NO

have query cache YES

have raid YES

have rtree keys YES

have symlink YES

init connect

init file

init slave

innodb additional mem pool size 1,048,576

innodb autoextend increment 8

innodb buffer pool awe mem mb 0

innodb buffer pool size 8,388,608

innodb data file path

innodb data home dir

innodb fast shutdown ON

innodb file io threads 4

innodb file per table OFF

innodb flush log at trx commit 1

innodb flush method

innodb force recovery 0

innodb lock wait timeout 50

innodb locks unsafe for binlog OFF

innodb log arch dir

innodb log archive OFF

innodb log buffer size 1,048,576

innodb log file size 5,242,880

innodb log files in group 2

innodb log group home dir

innodb max dirty pages pct 90

innodb max purge lag 0

innodb mirrored log groups 1

innodb open files 300

innodb table locks ON

innodb thread concurrency 8

interactive timeout 28,800

join buffer size 131,072

key buffer size 33,554,432

key cache age threshold 300

key cache block size 1,024

key cache division limit 100

language /usr/share/mysql/english/

large files support ON

license GPL

local infile ON

locked in memory OFF

log OFF

log bin OFF

log error

log slave updates OFF

log slow queries OFF

log update OFF

log warnings 1

long query time 10

low priority updates OFF

lower case file system OFF

lower case table names 0

max allowed packet 33,553,408

max binlog cache size 4,294,967,295

max binlog size 1,073,741,824

max connect errors 10

max connections 100

max delayed threads 20

max error count 64

max heap table size 16,777,216

max insert delayed threads 20

max join size 18,446,744,073,709,552,000

max length for sort data 1,024

max relay log size 0

max seeks for key 4,294,967,295

max sort length 1,024

max tmp tables 32

max user connections 0

max write lock count 4,294,967,295

myisam data pointer size 4

myisam max extra sort file size 2,147,483,648

myisam max sort file size 2,147,483,647

myisam recover options OFF

myisam repair threads 1

myisam sort buffer size 8,388,608

myisam stats method nulls_unequal

ndb autoincrement prefetch sz 32

ndb force send ON

ndb use exact count ON

ndb use transactions ON

(グローバル値) OFF

net buffer length 16,384

net read timeout 30

net retry count 10

net write timeout 60

new OFF

old passwords ON

open files limit 4,206

pid file /var/run/mysqld/mysqld.pid

port 3,306

preload buffer size 32,768

protocol version 10

query alloc block size 8,192

query cache limit 2,097,152

query cache min res unit 4,096

query cache size 52,428,800

query cache type ON

query cache wlock invalidate OFF

query prealloc size 8,192

range alloc block size 2,048

read buffer size 4,190,208

read only OFF

read rnd buffer size 262,144

relay log purge ON

relay log space limit 0

rpl recovery rank 0

secure auth OFF

server id 0

skip external locking ON

skip networking OFF

skip show database OFF

slave net timeout 3,600

slave transaction retries 0

slow launch time 2

socket /var/run/mysqld/mysqld.sock

sort buffer size 4,194,296

sql mode

sql notes ON

sql warnings ON

storage engine MyISAM

sync binlog 0

sync frm ON

sync replication 0

sync replication slave id 0

sync replication timeout 0

system time zone CET

table cache 2,048

table type MyISAM

thread cache size 32

thread stack 524,288

time format %H:%i:%s

time zone SYSTEM

tmp table size 33,554,432

tmpdir /tmp

transaction alloc block size 8,192

transaction prealloc size 4,096

tx isolation REPEATABLE-READ

version 4.1.15-Debian_1

version comment Source distribution

version compile machine i486

version compile os pc-linux-gnu

wait timeout 28,800