直接輸出中文標籤內容會顯示亂碼,例如:
$this->Label1->Caption = 'This is a Test'; // 正常
$this->Label2->Caption = '揚帆測試delphi for php'; // 亂碼
IDE 默認字符集非 GB2312/UTF-8,導致中文編碼錯誤。並非產品缺陷,僅是默認配置不符合中文環境。
設置後運行,中文標籤正確顯示,問題徹底解決。
php.ini 或腳本頭部 header('Content-Type: text/html; charset=gb2312') 指定。