我从 mysql 数据库中获取结果,并且正在创建 excel 文件。但是,虽然英文字符正确显示,但希腊字符显示为符号(不可读)。
这是我此时拥有的代码:
//function cleanData(&$str){
// replace fields that _ACCOUNT_DELETE and turn Capital letters into small
//$str=strtolower($str);
//}
// file name for download
$filename = "customers" . date('Ymd') . ".xls";
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-Type: application/vnd.ms-excel");
header('Content-Transfer-Encoding: utf-8');
$flag = false;
$query="SELECT * FROM customers";
$result = mysql_query($query);
while(false !== ($row = mysql_fetch_assoc($result))){
if(!$flag){
// display field/column names as first row
echo "Customers\n";
$flag = true;
}
//array_walk($row, 'cleanData');
echo implode("\t", array_values($row)) . "\n";
}
数据库编码是latin1_swedish_ci
任何帮助将不胜感激。