[問題]phpbb2.0.21文章標題UNICODE碼問題

phpBB Installation & Usage Support
phpBB 2 安裝於各類型作業平台之問題討論;外掛問題,請到相關版面依發問格式發表!
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

版面規則
本區是討論關於 phpBB 2.0.X 架設安裝上的問題,只要有安裝任何外掛,請到外掛討論相關版面按照公告格式發表。
(發表文章請按照公告格式發表,違者砍文)
主題已鎖定
阿治
星球普通子民
星球普通子民
文章: 1
註冊時間: 2005-10-14 10:23

[問題]phpbb2.0.21文章標題UNICODE碼問題

文章 阿治 »

[環境]
●架設主機作業系統:Windows2000Server
●架站程式:IIS
●上網方式:學術網
●您安裝的程式:IIS + php + MySql
●您的 phpBB2 版本:phpBB2.0.21


[問題描述]
------------------------------------------------------------------------------
整個PHPBB站顯示中文均正常, 但在文章標題的地方確是以UNICODE碼顥示, 如文字:
---------------------------------------

代碼: 選擇全部

測test --變成-->& #28204;test
---------------------------------------
p.s上面例子實際上&和#之間是沒有空格的
但如果是打在發文內文則顥示正常
我直接看資料庫後發現, 在phpbb_posts_text資料表中的post_subject欄位,原本應該編碼成"& #28204;test"的文字,
都變成測test
多了一個amp; 我想是這個原因造成文章標題都無法顥示中文字, 但不知如何解決
不知有人有相同狀況? 該如何解決 :cry:
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8547
註冊時間: 2004-04-30 01:54
來自: Taiwan

文章 心靈捕手 »

我猜想:
您的論壇語系編碼是 'big5'

建議您:
1. 貼出論壇網址
2. 提供測試用帳號與密碼
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
chiouss
竹貓忠實會員
竹貓忠實會員
文章: 1741
註冊時間: 2002-11-29 18:19

文章 chiouss »

昨天翻翻 phpBB 的 FAQ.html 才發現內容好像有增加了,裡面第 12 項有寫到這種問題,不知道有沒有用?
12. I am seeing &#nnnn; sequences output instead of what I typed!

To enable compliance with HTML and XHTML specifications as well as enabling browsers to automatically support a users selected language we enable a charset tag to be output to the browser. This identifies the primary character set the user has selected, eg. iso-8859-1 for Western European languages (English, German, French, etc.), windows-1251 for Cyrillic alphabets (Russian, Bulgarian, etc.) and so on. The downside to doing this is that most modern browsers (such as Internet Explorer) convert any character not present in that character set into what are termed Numerical Character References or NCR's. These take the form of &#nnnn; where nnnn is the hexadecimal number of that characters UNICODE reference.

Unfortunately PHP (which effectively supports only iso-8859-1 at this time) does not appear to attempt to process this data back into normal characters. Therefore phpBB treats them as text the user has entered and wishes to see. phpBB enables this by turning the & into &. This results in the characters appearing as they do. Although we could ignore &#nnnn; (there are pro's and of course con's to doing so) at present we don't.

If you are finding this to be problem the solution is to remove the

代碼: 選擇全部

charset={S_CONTENT_ENCODING}
text from all the _header.tpl template files in all templates. The downside to this is a users browser will not automatically switch its charset to that selected by the user (however this is unlikely to be a big problem since users typically run their browser by default in the language they wish to use). Alternatively you can modify the $lang['ENCODING'] entry in the appropriate language file. Until PHP (and all browsers!) trully support UNICODE these problems will persist across all boards.
主題已鎖定

回到「phpBB 2 安裝與使用」