PHP’s libmysql (Again)




default-character-set = utf8
default-collation = utf8_unicode_ci


建議所有管理自己機器的人用這個方法解決亂碼問題。這也是MySQL5 CJK FAQ建議的方法。當然重新編譯libmysql也是可以的,但是那個太複雜了我也不知道怎麼做orz。


mysql_query("SET NAMES 'UTF8'");
mysql_query("SET CHARACTER SET UTF8");


To sum up, there are two solutions for php to connect MySQL server using the correct charset. When the connected in wrong charsets, all non-utf8 characters becomes question marks.

This is the correction to the previous post.

The first solution is to put the following lines in my.cnf under [mysqld] session. Works on both MySQL on Win32 and Linux.

default-character-set = utf8
default-collation = utf8_unicode_ci

The first two lines changes MySQL default to what the charest needed, and the third one ask MySQL to ignore what libmysql said about the charset – which always attempts to connect with utf8 charset.

This is the solution in MySQL5 CJK FAQ and it’s recommends for everyone with their own machines.

It’s can also be done by re-compile libmysql which is technical advanced and the I-don’t-know-how-to-do-it-so-don’-ask method.

For people did not have control over their MySQL-PHP environment but facing wrong charset connection all the time, you must add following line after every mysql_connect() in PHP scripts.

mysql_query("SET NAMES 'UTF8'");
mysql_query("SET CHARACTER SET UTF8");

This is kind of annoying and is required even in the programs you downloaded. WordPress is included and should be added in wp-db.php.

Messier 101

Messier 101

這是用鹿林天文台 LOT 拍的,再用 MaxIm DL 4 做 RVB三色合成。

原本選的target是NGC4561啦,不過它太小了… 可見我們有多麼不專業:-p;因為我也只會做Dark、Bias、Flat、Bloom,沒有移除的宇宙射線的痕跡所以還是有雜點。


This image was taken using Lu-Lin LOT, then combine colours (R-V-B) with MaxIm DL 4.

My target was NGC5461, but turnout it was too small. Also being a new student on telescopes, I couldn’t remove bright dots cause by cosmic ray.

LOT is the biggest telescope in Taiwan.

MSN 和 Yahoo! Messenger 互連

國生三年才開始 » MSN 和 Yahoo! Messenger 互連開測。好大的新聞呀。

我按了Live Messenger[新增聯絡人]視窗裡的[加入BETA]連結啟用了這個功能,但是發現我已經沒有(只)用即時通的朋友讓我需要這個功能了。


From today, users of Windows Live Messenger can add their Yahoo! Messenger friends as contacts. One must join the beta program to enable the function.

I done that before I realise that I have no friends using Yahoo! Messenger which is popular among the teens (<18yrs-old). Does that means I am … old?