|
Perl 的 MySQL UTF8 破解法 .. my $dbh = DBI->connect("dbi:mysql:test", "xxx", "xxx");
# there are posts on dbi-user as to whether both or either of
# the following should be set
$dbh->do("set character set utf8");
檔案位於 /usr/local/sbin/amavisd
第 13516 行,位於 sub connect_to_sql {} 內。
有此需求的原因在於 ... 我的伺服器使用了 amavisd-new 這個郵件掃瞄套件 ..
它有個功能是可以將郵件的進出紀錄在 mysql 中. 而郵件主旨不乏會有中文 .. 而且我專為 amavisd-new 所建立的資料庫格式是 utf8 .. 自然而然亂碼的問題就會浮現 .. 在前面的文章有破解過 SMF 中的 php 與 mysql 的 UTF8 ... 而此問題就是 Perl 與 MySQL 的 UTF8. Google 真是太好用了 .. 輸入關鍵字 .. Perl mysql utf8 .. 快速 review 幾篇內容 ..專找 perl 在資料庫連線部分的內容 .. 要找的答案就在其中 .. Post a comment
|