zh-tw:pagename
差異處
這裏顯示兩個版本的差異處。
兩邊的前次修訂版前次修改 下次修改 | 前次修改 最後一次修改 兩邊的下次修訂版 | ||
zh-tw:pagename [2011-03-19 16:02] – 140.124.3.20 | zh-tw:pagename [2015-01-20 17:16] – 120.127.8.43 | ||
---|---|---|---|
行 1: | 行 1: | ||
- | ====== Pagenames ====== | + | 第一組 |
- | + | ||
- | Pagenames簡單的來說就是wiki中頁面的名稱.在Dokuwiki實際的檔案架構中, | + | |
- | + | ||
- | 在[[DokuWiki]]中, | + | |
- | 至於冒號":" | + | |
- | + | ||
- | 如果您使用中文命名, | + | |
- | \\ | + | |
- | \\ | + | |
- | \\ | + | |
- | 你可以看到完整的Pagename在wiki中任何一頁上方.像是你現在應該看到的是'' | + | |
- | + | ||
- | 當你使用[[InterWiki]]的方法連結至其他的Wiki, | + | |
- | + | ||
- | 即使Admin在 [[config]] 中設定容許使用 [[wp> | + | |
- | \\ | + | |
- | \\ | + | |
- | \\ | + | |
- | \\ | + | |
- | + | ||
- | ====== 關於中文頁面名稱亂碼的解決方法 ====== | + | |
- | + | ||
- | ===== 伺服器環境 ===== | + | |
- | * windows XP Profession SP2 | + | |
- | * Apache2.0.54 | + | |
- | * PHP5.0.4 | + | |
- | * PHP加載了mb_string模塊 | + | |
- | ===== 解決辦法 ===== | + | |
- | 這是一個不成熟的辦法,在分別測試了PmWiki與DokuWiki後,覺得DokuWiki很不錯。 | + | |
- | 特別是它的存儲文本文件,直接打開也是清晰可讀的。 | + | |
- | + | ||
- | 比較遺憾的是,文件名是亂碼((其實不是亂碼,是進行了urlencode編碼,我們看不懂而已)),為了解決這個問題, | + | |
- | 對\inc\utf8.php做以下就可以了,經過初步測試沒有問題: | + | |
- | + | ||
- | * 修改對文件名進行編碼、解碼的兩個函數:utf8_encodeFN、utf8_decodeFN | + | |
- | + | ||
- | <code php> | + | |
- | function utf8_encodeFN($file, | + | |
- | if($safe && preg_match('# | + | |
- | return $file; | + | |
- | } | + | |
- | / | + | |
- | $file = urlencode($file); | + | |
- | $file = str_replace(' | + | |
- | // | + | |
- | $file=mb_convert_encoding($file," | + | |
- | // | + | |
- | return $file; | + | |
- | } | + | |
- | + | ||
- | function utf8_decodeFN($file){ | + | |
- | /* 我註釋掉的部分 | + | |
- | $file = urldecode($file); | + | |
- | // | + | |
- | if(preg_match('# | + | |
- | return $file; | + | |
- | } | + | |
- | $file=mb_convert_encoding($file," | + | |
- | // | + | |
- | return $file; | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | * 對於不同的內碼,將" | + | |
- | * CP936是簡體中文、CP950是繁體中文 | + | |
- | 這樣所有的中文連結都將以正確的中文文件名儲存了。 | + | |
- | + | ||
- | ===== BUG與缺點 ===== | + | |
- | 目前知道的不足有以下一些: | + | |
- | - 需要mb_string模塊支援; | + | |
- | - 對文件名進行了編碼轉換,估計會影響運行的效率((不過對於我這種個人用戶來講,影響不大)); | + | |
- | - 當更換作業系統時,還需要增加內容,對文件名進行mb_detect_encoding處理; | + | |
- | - 會和Tag plugin的index功能衝突,產生亂碼的index | + | |
- | \\ | + | |
- | \\ | + | |
- | + | ||
- | ====== 關於中文頁面名亂碼的解決辦法2 ====== | + | |
- | ===== 伺服器環境 ===== | + | |
- | * windows XP Profession SP2 | + | |
- | * IIS | + | |
- | * PHP4 | + | |
- | ===== 解決辦法 ===== | + | |
- | 小弟受上面這位大哥的啟發,作了一下改進,現在可以不用mb_string模塊的支援了。經過初步測試沒有問題:\\ | + | |
- | --- // | + | |
- | + | ||
- | * 需要從[[http:// | + | |
- | * 將encoding目錄中的encoding.inc.php文件中的「var $FilePath」修改為encoding類的完整路徑; | + | |
- | * 對inc目錄下的utf8.php中的函數utf8_encodeFN和utf8_decodeFN作如下修改: | + | |
- | <code php> | + | |
- | require_once(DOKU_INC.' | + | |
- | + | ||
- | function utf8_encodeFN($file, | + | |
- | if($safe && preg_match('# | + | |
- | return $file; | + | |
- | } | + | |
- | / | + | |
- | $file = urlencode($file); | + | |
- | $file = str_replace(' | + | |
- | // | + | |
- | $CharEncoding=new Encoding(); | + | |
- | $CharEncoding-> | + | |
- | $CharEncoding-> | + | |
- | $file=$CharEncoding-> | + | |
- | // | + | |
- | return $file; | + | |
- | } | + | |
- | + | ||
- | function utf8_decodeFN($file){ | + | |
- | /* 我註釋掉的部分 | + | |
- | $file = urldecode($file); | + | |
- | // | + | |
- | if(preg_match('# | + | |
- | return $file; | + | |
- | } | + | |
- | $CharEncoding=new Encoding(); | + | |
- | $CharEncoding-> | + | |
- | $CharEncoding-> | + | |
- | $file=$CharEncoding-> | + | |
- | // | + | |
- | return $file; | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | 這樣所有的中文連結都將以正確的中文文件名存儲了。 | + | |
- | \\ | + | |
- | \\ | + | |
- | 大家有問題可以到[[discussion: | + | |
- | ---- | + | |
- | + | ||
- | ====== 關於中文頁面名亂碼的解決辦法-之Windows下亂碼 ====== | + | |
- | ===== 伺服器環境 ===== | + | |
- | * windows Server 2008R2 | + | |
- | * Apache 2.2 | + | |
- | * PHP 5 | + | |
- | * dokuwiki-2010-11-07a.tgz “Anteater” | + | |
- | + | ||
- | 新版本可以直接設定編碼是UTF-8, | + | |
- | + | ||
- | 但是windows還是使用big5作為目錄與檔名的編碼 | + | |
- | 如是在windows下,這三種方法還是得到亂碼 | + | |
- | + | ||
- | 我作了以下的修改可以正常的運作 | + | |
- | + | ||
- | 1.conf/ | + | |
- | 修改$conf[' | + | |
- | + | ||
- | 2.inc/ | + | |
- | <code php> | + | |
- | function utf8_encodeFN($file, | + | |
- | global $conf; | + | |
- | ...略 | + | |
- | + | ||
- | if($conf[' | + | |
- | return SafeFN:: | + | |
- | } | + | |
- | + | ||
- | // | + | |
- | if($conf[' | + | |
- | return mb_convert_encoding($file,' | + | |
- | } | + | |
- | //到這 | + | |
- | + | ||
- | $file = urlencode($file); | + | |
- | $file = str_replace(' | + | |
- | return $file; | + | |
- | } | + | |
- | ... | + | |
- | function utf8_decodeFN($file){ | + | |
- | global $conf; | + | |
- | if($conf[' | + | |
- | + | ||
- | if($conf[' | + | |
- | return SafeFN:: | + | |
- | } | + | |
- | + | ||
- | // | + | |
- | if($conf[' | + | |
- | return mb_convert_encoding($file,' | + | |
- | } | + | |
- | //到這 | + | |
- | + | ||
- | return urldecode($file); | + | |
- | return $file; | + | |
- | } | + | |
- | </ | + | |
- | 提供給大家參考 | + | |
- | ---- | + | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | 本頁面授權方式為[[http:// | + |
zh-tw/pagename.txt · 上一次變更: 2015-01-21 01:44 由 ach