简要咨询咨询QQ网站导航网站搜索手机站点联系我们设为首页加入收藏 

Discuz! 导出搜索用户比实际少的问题

来源:易贤网   阅读:1143 次  日期:2014-09-02 17:12:30

温馨提示:易贤网小编为您整理了“Discuz! 导出搜索用户比实际少的问题”,方便广大网友查阅!

问题现象:

后台用户管理搜索用户然后导出,导出的用户数比实际的少

问题分析:

Discuz! 函数中的使用的是diconv函数进行的转换,通过调试发现转换为GBK编码的时候使用iconv函数进行转换时,字符被截取了。但是 $out = iconv($in_charset, $out_charset.'//IGNORE', $str); 是带有 ‘//IGNORE ’ 代表遇到转换不了的字符忽略,然而还是被截取了。最后查资料发现是iconv的bug,将iconv从‘glibc’ 更改为 ‘libiconv ’ (重新编译iconv模块) 或者,使用 mb_convert_encoding来进行转换

解决方法:

1、 Linux环境重新编译iconv, 从‘glibc’ 更改为 ‘libiconv ’ (具体编译请到网上搜索相关资料)

2、使用mb_convert_encoding 代替 iconv

打开:source/function/function_core.php

function diconv($str, $in_charset, $out_charset = CHARSET, $ForceTable = FALSE) {

global $_G;

$in_charset = strtoupper($in_charset);

$out_charset = strtoupper($out_charset);

if(empty($str) || $in_charset == $out_charset) {

return $str;

}

$out = '';

if(!$ForceTable) {

if(function_exists('iconv')) {

$out = iconv($in_charset, $out_charset.'//IGNORE', $str);

} elseif(function_exists('mb_convert_encoding')) {

$out = mb_convert_encoding($str, $out_charset, $in_charset);

}

}

if($out == '') {

$chinese = new Chinese($in_charset, $out_charset, true);

$out = $chinese->Convert($str);

}

return $out;

}

更改为

function diconv($str, $in_charset, $out_charset = CHARSET, $ForceTable = FALSE) {

global $_G;

$in_charset = strtoupper($in_charset);

$out_charset = strtoupper($out_charset);

if(empty($str) || $in_charset == $out_charset) {

return $str;

}

$out = '';

if(!$ForceTable) {

if(function_exists('mb_convert_encoding')) {

$out = mb_convert_encoding($str, $out_charset, $in_charset);

}elseif(function_exists('iconv')) {

$out = iconv($in_charset, $out_charset.'//IGNORE', $str);

}

}

if($out == '') {

$chinese = new Chinese($in_charset, $out_charset, true);

$out = $chinese->Convert($str);

}

return $out;

}

提示: 使用mb_convert_encoding 函数需要开启mbstring模块

更多信息请查看IT技术专栏

更多信息请查看CMS教程
点此处就本文及相关问题在本站进行非正式的简要咨询(便捷快速)】     【点此处查询各地各类考试咨询QQ号码及交流群
上一篇:WordPress技巧:提高WordPress搜索相关性
下一篇:WordPress博客程序优化的5大要点
易贤网手机网站地址:Discuz! 导出搜索用户比实际少的问题
由于各方面情况的不断调整与变化,易贤网提供的所有考试信息和咨询回复仅供参考,敬请考生以权威部门公布的正式信息和咨询为准!
相关阅读      CMS教程