Programming: March 2010 Archives

Script Sample:
wget -qO- "台中市中山路1號&output=csv"

(3rd column is latitude, 4th is longitude)

PHP Sample:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "$address&output=csv");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
echo "Latitude: $output[2]
Longitude: $output[3]

Latitude: 24.1371957
Longitude: 120.6842909

ref. Google API 透過 HTTP 進行地理編碼

UTF-8 CSV for Excel

Vote 0 Votes

本來以為 Excel 不支援 UTF-8 的 CSV,
一直都是轉成 Big5 輸出, 但是遇到像「喆」這種 Big5 中沒有的字, 就會有掉字問題.

原來只要在加入 BOM 檔頭, Excel 就可以正常讀取,
PHP 加入 fputs($fp,"\xEF\xBB\xBF");

但是 Excel 似乎沒辦法存 UTF-8 格式的 CSV.

ref. PHP匯出 Excel可讀的UTF-8編碼CSV檔案

About this Archive

This page is an archive of entries in the Programming category from March 2010.

Programming: September 2009 is the previous archive.

Programming: February 2011 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Monthly Archives