Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

后台搜索用户导出比实际少的问题

[复制链接]
evenzhou 发表于 2012-11-30 16:57:40 | 显示全部楼层 |阅读模式
本帖最后由 evenzhou 于 2012-11-30 17:01 编辑

问题现象:
     后台用户管理搜索用户然后导出,导出的用户数比实际的少
问题分析:
     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
  1. function diconv($str, $in_charset, $out_charset = CHARSET, $ForceTable = FALSE) {
  2.         global $_G;

  3.         $in_charset = strtoupper($in_charset);
  4.         $out_charset = strtoupper($out_charset);

  5.         if(empty($str) || $in_charset == $out_charset) {
  6.                 return $str;
  7.         }

  8.         $out = '';

  9.         if(!$ForceTable) {
  10.                 if(function_exists('iconv')) {
  11.                         $out = iconv($in_charset, $out_charset.'//IGNORE', $str);
  12.                 } elseif(function_exists('mb_convert_encoding')) {
  13.                         $out = mb_convert_encoding($str, $out_charset, $in_charset);
  14.                 }
  15.         }

  16.         if($out == '') {
  17.                 $chinese = new Chinese($in_charset, $out_charset, true);
  18.                 $out = $chinese->Convert($str);
  19.         }

  20.         return $out;
  21. }
复制代码
更改为:
  1. function diconv($str, $in_charset, $out_charset = CHARSET, $ForceTable = FALSE) {
  2.         global $_G;

  3.         $in_charset = strtoupper($in_charset);
  4.         $out_charset = strtoupper($out_charset);

  5.         if(empty($str) || $in_charset == $out_charset) {
  6.                 return $str;
  7.         }

  8.         $out = '';

  9.         if(!$ForceTable) {
  10.                 if(function_exists('mb_convert_encoding')) {
  11.                         $out = mb_convert_encoding($str, $out_charset, $in_charset);
  12.                 }elseif(function_exists('iconv')) {
  13.                         $out = iconv($in_charset, $out_charset.'//IGNORE', $str);
  14.                 }
  15.         }

  16.         if($out == '') {
  17.                 $chinese = new Chinese($in_charset, $out_charset, true);
  18.                 $out = $chinese->Convert($str);
  19.         }

  20.         return $out;
  21. }
复制代码
提示: 使用mb_convert_encoding 函数需要开启mbstring模块



m.king 发表于 2012-11-30 17:00:00 | 显示全部楼层
好东西!!!!!!!!!!!!!
回复

使用道具 举报

。See_you_tomor 发表于 2012-11-30 17:08:38 | 显示全部楼层
m.king 发表于 2012-11-30 17:00
好东西!!!!!!!!!!!!!

沙发送你了,我挤个椅子就可以了
回复

使用道具 举报

1314学习网 发表于 2012-11-30 17:46:22 | 显示全部楼层
呵呵,受教了。。。
回复

使用道具 举报

ARCHY` 发表于 2012-11-30 18:00:54 | 显示全部楼层
不能不顶你下
回复

使用道具 举报

benchi120123 发表于 2012-12-1 18:15:51 | 显示全部楼层
很有用,支持下
回复

使用道具 举报

若芯 发表于 2012-12-3 02:31:47 | 显示全部楼层
学习一下!
回复

使用道具 举报

abcnic1 发表于 2012-12-3 15:16:55 | 显示全部楼层
不错 学习了
回复

使用道具 举报

ss0t 发表于 2012-12-5 12:37:24 | 显示全部楼层
请问DZ2.5家园里心情记录怎么修改字数限制?默认的只能发表200个字符,我想能发表更多字符的心情记录怎么办 ?应该在哪里进行修改,求给个合理的解决方案,我是菜鸟,希望可以说清楚一点,谢谢
回复

使用道具 举报

钻石家族 发表于 2012-12-11 20:49:14 | 显示全部楼层
本帖最后由 钻石家族 于 2012-12-11 21:00 编辑

这个问题好久之前就有















东莞公交路线 汉方甘泰茶 站长论坛 http://www.dgzhilu.com
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-4-20 12:00 , Processed in 0.287707 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表