以下内容为根据英文的[[..pagename]]翻译并修改得到。 ===== 页面名和命名空间 ===== 你可以将命名空间描述成文件夹,页面名描述成其中的文件! 因此,页面名''a:b:c'' 可描述为: 根级命名空间 (总是存在的) | +-- 'a' 命名空间 | +-- 'b' 命名空间 | +-- 'c' 页面名 要注意,命名空间与页面名可以相同。例如,在上面的例子中,页面名''a:b'' 可描述成: 根级命名空间 (总是存在的) | +-- 'a' 命名空间 | +-- 'b' 页面名 (不要与上面提到的命名空间 'b'混淆) ===== 创建页面名 ===== 当浏览器请求一个尚不存在的页面名之时,DokuWiki会给你提供选项让你创建它(这取决于你的访问权限)。你可以在另一个DokuWiki页面中创建一个链接,然后让浏览器访问该链接,从而创建新的页面。 如果你的页面名中包含不存在的页面空间,那么,该页面空间也会被自动创建。 ===== 删除页面名 ===== 如果你编辑一个页面名并移除其中的所有内容,那么,DokuWiki会删除该页面。 ===== 解决中文文件名乱码问题GBK格式 ===== 1.修改文件 \conf\local.php \\ 在末尾增加 $conf['fnencode'] = 'gbk'; 2.文件 \inc\pageutils.php \\ 修改utf8_encodeFN函数 function utf8_encodeFN($file,$safe=true){ global $conf; if($conf['fnencode'] == 'utf-8') return $file; if($safe && preg_match('#^[a-zA-Z0-9/_\-\.%]+$#',$file)){ return $file; } if($conf['fnencode'] == 'safe'){ return SafeFN::encode($file); } //新增下面这段代码 if($conf['fnencode'] == 'gbk'){ return mb_convert_encoding($file,'gbk','UTF-8'); } $file = urlencode($file); $file = str_replace('%2F','/',$file); return $file; } 修改utf8_decodeFN函数 function utf8_decodeFN($file){ global $conf; if($conf['fnencode'] == 'utf-8') return $file; if($conf['fnencode'] == 'safe'){ return SafeFN::decode($file); } //新增下面这段代码 if($conf['fnencode'] == 'gbk'){ return mb_convert_encoding($file,'UTF-8','gbk'); } return urldecode($file); } 文件名将会用GBK格式保存.将不会存在utf-8乱码的情况 但是索引和媒体管理器的树状目录会乱码 ===== 解决中文文件名乱码问题UTF-8格式 ===== 在conf\local.php配置文件中添加一行配置 $conf['fnencode'] = 'utf-8'; 即可解决乱码问题。 详情参见[[config:fnencode|config:fnencode]] 页面。 ==== 伺服器環境 ==== * MacOSX Snow Leopard 10.6.2 * Apache2.0.54 * PHP5.3.1 ===================== 经过分析,Dokuwiki是把文件名通过url_encode();之后再存储的... 另外两种方法参看这里: http://www.dokuwiki.org/zh-tw:pagename?do=show file: "\inc\utf8.php" function utf8_encodeFN($file,$safe=true){ if($safe && preg_match('#^[a-zA-Z0-9/_\-.%]+$#',$file)){ return $file; } /* 把这个部分注释掉 $file = urlencode($file); $file = str_replace('%2F','/',$file); */ return $file; } } if(!function_exists('utf8_decodeFN')){ /** * URL-Decode a filename * * This is just a wrapper around urldecode * * @author Andreas Gohr * @see urldecode */ function utf8_decodeFN($file){ //$file = urldecode($file); //再注释掉这个语句... return $file; } } //同样, 这样,文件名在我的系统上是正常显示了,不知道其他系统如何... ====== Windows XP windows 2003下采用UTF-8格式文件名乱码的解决方法 ====== * WinXP SP3 * Apache2.2.8 * PHP5.2.6 ===================== 修改\inc\pageutils.php中utf8_encodeFN、utf8_decodeFN两个函数 以下是我的修改 function utf8_encodeFN($file,$safe=true){ global $conf; if($conf['fnencode'] == 'utf-8') { $file=mb_convert_encoding($file,"CP936","UTF-8"); return $file;} if($safe && preg_match('#^[a-zA-Z0-9/_\-\.%]+$#',$file)){ return $file; } if($conf['fnencode'] == 'safe'){ return SafeFN::encode($file); } $file = urlencode($file); $file = str_replace('%2F','/',$file); return $file; } function utf8_decodeFN($file){ global $conf; if($conf['fnencode'] == 'utf-8') { $file=mb_convert_encoding($file,"UTF-8","CP936"); return $file;} if($conf['fnencode'] == 'safe'){ return SafeFN::decode($file); } return urldecode($file); } =====如果要跨系统使用===== 可以这样改: function utf8_encodeFN($file,$safe=true){ global $conf; //if($conf['fnencode'] == 'utf-8') return $file; if($conf['fnencode'] == 'utf-8'){ if(eregi('win', PHP_OS)){ $file=mb_convert_encoding($file,"CP936","UTF-8"); } return $file; } if($safe && preg_match('#^[a-zA-Z0-9/_\-\.%]+$#',$file)){ return $file; } if($conf['fnencode'] == 'safe'){ return SafeFN::encode($file); } $file = urlencode($file); $file = str_replace('%2F','/',$file); return $file; } function utf8_decodeFN($file){ global $conf; //if($conf['fnencode'] == 'utf-8') return $file; if($conf['fnencode'] == 'utf-8'){ if(eregi('win', PHP_OS)){ $file=mb_convert_encoding($file,"UTF-8","CP936"); } return $file; } if($conf['fnencode'] == 'safe'){ return SafeFN::decode($file); } return urldecode($file); } =====windows系统中文乱码自动转换程序===== """ dokuwiki转码程序。(请将本程序保存为utf8文本) 作用:将dokuwiki默认的编码方式编码生成的目录名、文件名,统一转换为可识别的中文。 要求python版本大于等于3.4 """ from pathlib import Path from urllib.parse import unquote wikipath = 'd:/lzweb/wiki' # 请在这里设置好dokuwiki的安装目录 rootpath = Path(wikipath) rootpath = rootpath / 'data' def pathRename(path): # 对path进行转码 newname = path.parent / unquote(path.name) path.rename(newname) def dealpath(path): # 对path下的全部文件和目录进行递归编码转换 allpath = path.glob('*') # 遍历path下的第一层目录 for p in allpath: if p.is_file(): pathRename(p) elif p.is_dir(): # 如果是目录 dealpath(p) # 先对目录下的所有内容改名 pathRename(p) # 再对该目录改名 print('转码开始,请耐心等候...') dealpath(rootpath) print('完成全部转换。') 使用时,设置下wikipath即可。注意python版本至少是3.4。