ku0522 | Shared With: Everyone - Jul 15 2008 | mysql, PHP, cakePHP
文字化け
Quoted: これを app/config/database.php で設定する方法です。
'encoding'=>'文字コード'
をデータベースの設定項目に追加してやるだけです。具体的には app/config/database.php が下記のようになります。
var $default = array(
'driver' => 'mysql',
'connect' => 'mysql_connect',
'host' => 'localhost',
'login' => 'user',
'password' => 'password',
'database' => 'dbname',
'prefix' => '',
'encoding' => 'utf8'
);
ku0522 | Shared With: Everyone - Jul 04 2008 | MySQLコレーション。
MySQL での文字列比較だと、データベースの性質上からも 1. のケースが圧倒的に多くて、utf8_unicode_ci とか、適当な collation を使うことで全角半角問題に対応できます。MySQL では strings/ctype-uca.c に書かれている実装になっています。
Currently supports only subset of the full UCA:
- Only Primary level key comparison
- Basic Latin letters contraction is implemented
- Variable weighting is done for Non-ignorable optionFeatures that are not implemented yet:
- No Normalization From D is done
+ No decomposition is done
+ No Thai/Lao orderding is done
- No combining marks processing is done
SQL ではこんな感じです。
SELECT * FROM texts WHERE text_str = 'ア' COLLATE utf8_unicode_ci
ku0522 | Shared With: Everyone - Sep 11 2007 | MySQL, 文字化けQuoted: #PHPでの文字化け回避:サーバーの文字コード設定をクライアントでもそのまま使う
skip-character-set-client-handshake
ku0522 | Shared With: Everyone - Aug 23 2007 | solaris, senna, mysql
ku0522 | Shared With: Everyone - Aug 08 2007 | mysql, PHP, perl, searchNgram生成 window_size = 2 だと使い物にならないのでおおきくする
ku0522 | Shared With: Everyone - Jul 29 2007 | MySQL
ku0522 | Shared With: Everyone - Jul 10 2007 | mysql, PHPa mysql driver optimized for PHP.
ku0522 | Shared With: Everyone - Nov 22 2006 | mysql
ku0522 | Shared With: Everyone - Jun 15 2006 | MySQL, tosee, howto
ku0522 | Shared With: Everyone - Mar 30 2006 | mixi, operation, MySQL
Related Content from Around Faves
mysql
-
This is a detailed description about how to set up a Mandriva 2008 Free (Mandriva 2008.0) server that offers all services needed by ISPs and hosters: Apache web server (SSL-capable), Postfix mail server with SMTP-AUTH and TLS, BIND DNS server, Proftpd FTP server, MySQL server, Courier POP3/IMAP, Quota, Firewall, etc. This tutorial is written for the 32-bit version of Mandriva 2008, but should apply to the 64-bit version with very little modifications as well.
1 FaverViewed: 12 Times - falko - Jun 17 20081 FaverViewed: 7 Times
- ketchup - Sep 11 20081 FaverViewed: 4 Times
