久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线

返回列表 發帖
查看: 8856|回復: 2

后臺搜索用戶導出比實際少的問題

83

主題

-6

回帖

329

積分

爐火純青

貢獻
2 點
金幣
241 個
樓主
發表于 2019-6-2 19:10:44 | 只看樓主 |倒序瀏覽 |閱讀模式

問題現象:
     后臺用戶管理搜索用戶然后導出,導出的用戶數比實際的少
問題分析:
     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模塊



回復

使用道具 舉報

15

主題

1868

回帖

2164

積分

應用開發者

discuz 老兵

貢獻
11 點
金幣
198 個
QQ
沙發
發表于 2019-6-2 21:00:47 | 只看Ta
:):)收藏啦~
回復

使用道具 舉報

3

主題

121

回帖

188

積分

應用開發者

貢獻
0 點
金幣
58 個
板凳
發表于 2019-6-9 08:41:33 | 只看Ta
收藏,備用一下
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

  • 關注公眾號
  • 有償服務微信
  • 有償服務QQ

手機版|小黑屋|Discuz! 官方交流社區 ( 皖ICP備16010102號 |皖公網安備34010302002376號 )|網站地圖|star

GMT+8, 2025-9-18 09:15 , Processed in 0.067627 second(s), 27 queries .

Powered by Discuz! W1.0 Licensed

Copyright © 2001-2025 Discuz! Team.

關燈 在本版發帖
有償服務QQ
有償服務微信
返回頂部
快速回復 返回頂部 返回列表