首页 > Windows开发 > 详细

Dokuwiki API接口文档管理中文支持更改

时间:2015-05-08 18:31:27      阅读:445      评论:0      收藏:0      [点我收藏+]

1.文件 \conf\local.php 增加$conf[‘fnencode‘] = ‘gbk‘;如果存就更改

2.文件 \inc\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‘] == ‘gbk‘){
        return mb_convert_encoding($file,‘gbk‘,‘UTF-8‘);
    }
    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‘] == ‘safe‘){
        return SafeFN::decode($file);
    }
   //新增以下這段
    if($conf[‘fnencode‘] == ‘gbk‘){
        return mb_convert_encoding($file,‘UTF-8‘,‘gbk‘);
    }

    return urldecode($file);
}



结果:

技术分享技术分享

Dokuwiki API接口文档管理中文支持更改

原文:http://my.oschina.net/sorenring/blog/412380

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!