2006-11-30

mysql utf-8 中文亂碼解決方案

mysql utf-8 中文亂碼是一件令人感到非常頭痛的事, 所幸藉由 d.CAT the RIA blog. 發表的
這三篇文章, 有助於大家解決此類的問題

mysql中文亂碼的原因

# mysql server本身設定的問題
修改 mysql 的 config 檔 : my.ini (通常存放在作業系統的安裝目錄下, 或是在 C:\winnt\my.ini) 將 my.ini 裏的內容 default-character-set 設為utf8, 即 default-character-set=utf8
* 注意: 設了這一行 通常會導致一些open source的英文PHP軟體程式(如osCommerce/mediawiki) 有中文字碼錯誤的情形 如'裏'這個字. 因為他們語系大多為latin-1.

# mysql table 的語系設定問題
character與collation 都要設為 utf8_general_ci (連線校對)

# 客戶端程式的連接語系設定問題

Ex: PHP
header("Content-Type: text/html;charset=utf-8");
$host = "localhost"; /*連接資料庫位置*/
$link = mysql_connect($host,"帳號","密碼") or die("連線失敗");
mysql_query("SET NAMES 'utf8'"); //非常重要 告訴mysql這個connection之後的連線內容都使用utf-8.
mysql_select_db("mysql table name",$link) or die("資料庫連結錯誤:mysql table不存在");

讓 phpmyadmin 正常顯示中文

讓 phpmyadmin 正常顯示 utf-8 的中文字 要 設定 phpmyadmin 資料夾底下的 config.inc.php


$cfg['DefaultLang'] = 'en-iso-8859-1';
$cfg['DefaultCharset'] = 'iso-8859-1';
$cfg['AllowAnywhereRecoding'] = FALSE;
改成
$cfg['DefaultLang'] = 'utf-8';
$cfg['DefaultCharset'] = 'utf-8';
$cfg['AllowAnywhereRecoding'] = TRUE;

基本上我做了這些修改目前顯示出來的結果是正常的

that's all, try it.

2006-11-29

my photo

Open Source Web Design

Open Source Web Design

url: http://www.oswd.org/

You can download free web design templates.!!

Open Source Web Design is a site to download free web design templates
and share yours with others. We help make the internet a prettier place.

提供了免費的網頁樣版下載!! 非常方便喔!!

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

2006-11-28

url address icon

URL Address icon

just create an .ico file named favicon.ico (16 x 16) then put this file in the main directory of your website

add this line to the <head> section of your index page :
<link rel="shortcut icon" href="favicon.ico">

the ico should appear automatically in Netscape, but it may not work with all versions of Internet Explorer

digg

URL http://labs.digg.com/swarm/

flash 來呈現 結合 Web2.0 概念 的網頁

及時產生 '推文' 的資訊 當有使用者推文時 及時產生 黃點 表示

2006-11-20