dokuwidi版本号:$updateVersion = "49.5"; 来自 doku.php
[不保证其他版本的也使用同样方法解决,但大体思路应该相同]
- dokuwiki.php 中配置 $conf['fnencode'] = 'gb2312';
- pageutils.php 中修改两个函数(蓝色为添加的部分):
-
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判断开始
if ($conf['fnencode']=='gb2312'){
return iconv('UTF-8','GB2312',$file);
}
# if判断结束
$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'] == 'safe'){
return SafeFN::decode($file);
}
#添加该 if判断开始
if ($conf['fnencode']=='gb2312'){
return iconv('GB2312','UTF-8',$file);
}
#if判断结束
return urldecode($file);
}
然后就ok啦。重启容器,即可看到新增页面之后,本地存储的文件夹名称变成中文。
针对DokuWiki在Windows 7环境下新建页面出现的本地文件名乱码和URI编码问题,通过在dokuwiki.php中设置$conf['fnencode']为'gb2312',并修改pageutils.php中的utf8_encodeFN和utf8_decodeFN两个函数,添加对GBK编码的转换,成功解决了页面文件名显示为中文的问题。更新配置后,重启容器,本地存储的页面文件夹名称恢复正常。
5万+

被折叠的 条评论
为什么被折叠?



