廣告廣告
  加入我的最愛 設為首頁 風格修改
首頁 首尾
 手機版   訂閱   地圖  簡體 
您是第 9407 個閱讀者
 
發表文章 發表投票 回覆文章
  可列印版   加為IE收藏   收藏主題   上一主題 | 下一主題   
笑笑 會員卡 葫蘆墩家族
個人文章 個人相簿 個人日記 個人地圖
發文大師獎
頭銜:    
風雲人物
級別: 風雲人物 該用戶目前不上站
推文 x137 鮮花 x523
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片
推文 x0
[Delphi][教學] Delphi + ZeosLib + MySQL + UTF8 HowTo
最近公司的資料庫要升級為 UTF-8 所以遇到了蠻多的問題,公司的管理系統是用 Delphi 開發的,而資料庫是 MySQL,這幾天好不容易把資料庫由 big5 轉為 utf-8 ,不過讀進來都是亂碼,後來在網路上找到一篇不錯的教學,有用到的可以參考看看

轉貼自

After fiddling around with all these components I finally made a working database connection with my server. It appears to me, that all connections made to MySQL 4.1 default to the "latin1" encoding no matter what the database contains. To work with utf8 you have to tell Zeos to set up certain server variables. You can do this by executing the SQL command: "SET character_set_connection=utf8; SET character_set_results=utf8;" Starting that moment, MySQL expects to get ALL commands in utf8 and will also return all datasets in utf8! You can put these variables into your TZConnection.Properties String list:

character_set_connection=utf8
character_set_results=utf8
Hint: If you want Mysql to use 100% utf8 internally, just add the following to your TZConnection.Properties:

character_set_client=utf8
character_set_connection=utf8
character_set_database=utf8
character_set_results=utf8
character_set_server=utf8
character_set_system=utf8
collation_connection=utf8_general_ci
collation_database=utf8_general_ci
collation_server=utf8_general_ci
Codepage=utf8
Now that MySQL is returning everything in utf8 you have to make sure to use WideString variables ALWAYS.
For NON-BLOB fields you can use the following:

VAR MyString : WideString;
VAR DBString : UTF8String;
[...]
DBString := MyTable.FieldByName( ..

訪客只能看到部份內容,免費 加入會員 或由臉書 Google 可以看到全部內容




每天大笑三聲,可以讓你更長壽哦...^^
獻花 x0 回到頂端 [樓 主] From:臺灣中華電信HINET | Posted:2008-06-13 09:02 |
highleekimo
數位造型
個人文章 個人相簿 個人日記 個人地圖
路人甲
級別: 路人甲 該用戶目前不上站
推文 x0 鮮花 x0
分享: 轉寄此文章 Facebook Plurk Twitter 複製連結到剪貼簿 轉換為繁體 轉換為簡體 載入圖片

有沒有中文教學

英文看不太懂 表情


獻花 x0 回到頂端 [1 樓] From:臺灣中華HiNet | Posted:2009-06-24 11:17 |

首頁  發表文章 發表投票 回覆文章
Powered by PHPWind v1.3.6
Copyright © 2003-04 PHPWind
Processed in 0.018789 second(s),query:16 Gzip disabled
本站由 瀛睿律師事務所 擔任常年法律顧問 | 免責聲明 | 本網站已依台灣網站內容分級規定處理 | 連絡我們 | 訪客留言