Feed on
Posts
Comments
Email訂閱

description

  1. phpbb  big5 characters stored in a default latin1 encoding database
  2. waytogo db has utf-8 characters stored in in a default latin1 encoding database
  3. the above tables of two app s are stored in a same database, the will cause software upgrade difficultly and addition coding conversion is need specially some common  table like users
  4. goal: convert big5 data to utf-8 of phpbb database

step

  1. export phpbb tables from godaddy database server to local PC
  2. import such tables into phpMyAdmin at local side
  3. export these table with latin1 coding(iso-8859-1), now we can see Chinese characters in text editor e.g. Notepad ++
  4. convert text to utf-8 in text editor then save
  5. at phpMyadmin of godaddy database server, import these table with encoding latin1。Note that phpmyadmin of Windows version doesn’t has latin1 option but has iso-8859-1, this make some loss while convertion

後遺症

  1. 現在大多數軟體都已預設為utf8連線,phpbb 3也不例外。為了相容舊資料庫,上述的轉換只是將big5轉成utf8,但最終還是存回到latin1編碼的資料庫,而這來到phpBB3的網頁就會出現亂碼。解決的方法就是移除 include/db/mysql.php 與 include/db/mysqli.php 中的 @mysql_query(“SET NAMES ‘utf8′”, $this->db_connect_id);  
  2. 經過上述處理後,雖然網頁可以顯示中文,但是在viewforum.php或是viewtopic.php的版主仍是顯示亂碼。只能推測在做phpBB2->3的轉換檔過程中可能有用到 includes\functions_convert.php,而其中的 @mysql_query(“SET NAMES ‘utf8′”, $this->db_connect_id) 尚未移除,或者是 install\convertors\functions_phpbb20.php 與 install\install_convert.php 也有 @mysql_query(“SET NAMES ‘utf8′”, $this->db_connect_id) ,可能導致在設定版主時,將版主中文名稱寫到資料庫表格,此時是以unicode寫入。不過這個猜測是錯的。因為當uncomment時,也還是無法顯示中文。
  3. 目前是從godaddy直接安裝ap,再搭配中文包。其實未來可以直接下載網路上人家已經包好的。這樣應該問題比較少。
  4. post名稱字元長度預設為32,當進行以上轉檔時,原本超過32長度的post名稱會被截掉。目前不確定是否超過32的留言標題在留言存進資料庫時是不是就已經被裁掉?

 

留言區