• ↓爱上码• i3m.cn/2702•爱扫码 欢迎关注
  • #二维码.cn立刻有#二维码.cn/i3m.cn/2702
  • wwew.cn/i3m.cn/2702 →• i.i3m.cn/2702•←
  • 二维→•ErWei.com.cn/i3m.cn/2702•←
  • php识别中文编码并自动转换为UTF-8: i3h.cn/2702
    二维码2017-03-06 21:08
    PHP GBK UTF8互转
    @tea

    function gbk_to_utf8($str){
        return mb_convert_encoding($str, 'utf-8', 'gbk');
    }
             
    function utf8_to_gbk($str){
        return mb_convert_encoding($str, 'gbk', 'utf-8');
    }



    php识别中文编码并自动转换为UTF-8


    php自动识别编码,若里面有中文的话,将其转换为UTF-8就最好了,因为中文在Gbk编辑情况情况下,有可能会乱码,这个和客户端和服务端编码都有关系,为了避免乱码,我们可以使用下面的函数将其自动转换为UTF8国际标准编码:

    <?php
    function characet($data){
      if( !empty($data) ){
        $fileType = mb_detect_encoding($data , array('UTF-8','GBK','LATIN1','BIG5')) ;
        if( $fileType != 'UTF-8'){
          $data = mb_convert_encoding($data ,'utf-8' , $fileType);
        }
      }
      return $data;
    }
    ?>



    PHP——字符串统一转码为GBK,自动判断是否UTF8并转码

    public static function strToGBK($strText)
        {
            $encode = mb_detect_encoding($strText, array('UTF-8','GB2312','GBK'));
            if($encode == "UTF-8")
            {
                return @iconv('UTF-8','GB18030',$strText);
            }
            else
            {
                return $strText;
            }
        }


    mb_detect_encoding:检测字符的编码

    PHP GBK UTF8互转
    http://www.oschina.net/code/snippet_1443477_48480
    标签:GBK UTF8 编码转换  php识别中文编码并自动转换为UTF-8
    http://www.codefans.net/articles/1272.shtml
    PHP通过iconv将字符串从GBK转换为UTF8字符集
    http://www.jb51.net/article/27743.htm
    各种编码UNICODE、UTF-8、ANSI、ASCII、GB2312、GBK详解
    http://blog.csdn.net/lvxiangan/article/details/8151670

    站长工具 > 日常实用工具
    6个回复, 0个喜欢
    评论1 来自于:二维码
    2017-03-10 02:36   0人喜欢
    字体编辑用中日韩汉字Unicode编码表
    http://www.chi2ko.com/tool/CJK.htm




    Unicode 9.0 Character Code Charts

    SCRIPTS   |   SYMBOLS   |   NOTES
    Name index   Help & links

    Emoticons
    Range: 1F600–1F64F

    This file contains an excerpt from the character code tables and list of character names for
    The Unicode Standard, Version 9.0
    This file may be changed at any time without notice to reflect errata or other updates to the Unicode Standard.
    See http://www.unicode.org/errata/ for an up-to-date list of errata.
    See http://www.unicode.org/charts/ for access to a complete list of the latest character code charts.
    See http://www.unicode.org/charts/PDF/Unicode-9.0/ for charts showing only the characters added in Unicode 9.0.
    See http://www.unicode.org/Public/9.0.0/charts/ for a complete archived file of character code charts for Unicode 9.0
    http://www.unicode.org/charts/PDF/U1F600.pdf








    Symbols and Punctuation
    Notational Systems

    Braille Patterns
    Musical Symbols
    Ancient Greek Musical Notation
    Byzantine Musical Symbols
    Duployan
    Shorthand Format Controls
    Sutton SignWritingPunctuation

    General Punctuation
    ASCII Punctuation
    Latin-1 Punctuation
    Supplemental Punctuation
    CJK Symbols and Punctuation
    Ideographic Symbols and Punctuation
    CJK Compatibility Forms
    Halfwidth and Fullwidth Forms
    Small Form Variants
    Vertical FormsAlphanumeric Symbols

    Letterlike Symbols
    Roman Symbols
    Mathematical Alphanumeric Symbols
    Arabic Mathematical Alphabetic Symbols
    Enclosed Alphanumerics
    Enclosed Alphanumeric Supplement
    Enclosed CJK Letters and Months
    Enclosed Ideographic Supplement
    CJK Compatibility
    Additional Squared SymbolsTechnical Symbols
    评论2 来自于:二维码
    2017-03-10 02:38   0人喜欢
    APL symbols
    Control Pictures
    Miscellaneous Technical
    Optical Character Recognition (OCR)[td=1,1,293.609]Numbers & Digits

    (see also specific scripts)
    ASCII Digits
    Fullwidth ASCII Digits
    Common Indic Number Forms
    Coptic Epact Numbers
    Counting Rod Numerals
    Cuneiform Numbers and Punctuation
    Number Forms
    Rumi Numeral Symbols
    Sinhala Archaic Numbers
    Super and SubscriptsMathematical Symbols

    Arrows
    Supplemental Arrows-A
    Supplemental Arrows-B
    Supplemental Arrows-C
    Additional Arrows
    Miscellaneous Symbols and Arrows
    Mathematical Alphanumeric Symbols
    Arabic Mathematical Alphabetic Symbols
    Letterlike Symbols
    Mathematical Operators
    Basic operators: Plus, Factorial, Division, Multiplication
    Supplemental Mathematical Operators
    Miscellaneous Mathematical Symbols-A
    Miscellaneous Mathematical Symbols-B
    Floors and Ceilings
    Invisible Operators
    Geometric Shapes
    Additional Shapes
    Box Drawing
    Block Elements
    Geometric Shapes Extended[td=1,1,294.609]Emoji & Pictographs

    Dingbats
    Ornamental Dingbats
    Emoticons
    Miscellaneous Symbols
    Miscellaneous Symbols And Pictographs
    Supplemental Symbols and Pictographs
    Transport and Map Symbols
    评论3 来自于:二维码
    2017-03-10 02:54   0人喜欢
    9.0.0 Chapters  
    http://www.unicode.org/versions/Unicode9.0.0/

    1  Introduction  
    2  General Structure  
    3  Conformance  
    4  Character Properties  
    5  Implementation Guidelines  
    6  Writing Systems and Punctuation  
    7  Europe-I  
    8  Europe-II  
    9  Middle East-I  
    10  Middle East-II  
    11  Cuneiform and Hieroglyphs  
    12  South and Central Asia-I  
    13  South and Central Asia-II  
    14  South and Central Asia-III  
    15  South and Central Asia-IV  
    16  Southeast Asia  
    17  Indonesia and Oceania  


    18  East Asia  
    19  Africa  
    20  Americas  
    21  Notational Systems  
    22  Symbols  
    23  Special Areas and Format Characters  
    24  About the Code Charts
  • 二维码 ↓ php识别中文编码并自动转换为UTF-8
  • i3h.cn/2702爱3好谢谢分享
  • 二维码.cn:↑i.i3h.cn/2702
  • 葩葩搜:paps.cn/2702需登录i3h.cn
  • 搜一搜.cn/检索词/'手机号'/样式新帖
  • Soys.cn/2702/15359936221/祝福语
  • 二维码 • Uid:2↑搜一搜•Tid:Soys.cn/2702

  • w.联系.cnOQRC.com/ii地址g.iidz.cn/15359936221

    内容正在加载中,请稍候……

  • 楼主:二维码的地址↓E空间网: →ekjw.com/u2 ↓
  • 扫一扫.cn→:私信 u2←二维码.cn
  • 二维码.cn↓E科教网↓ ekjw.com/u2
  • 二维码.cn↑名片 w.ekjw.com/u2 ←微看见友
  • 二维码.cn楼帖: php识别中文编码并自动转换为UTF-8
  • 链接.cn原pc版→qrmi.cn/2702
  • 扫一扫.cn名本•i3好→i3h.cn/2702
  • 偶集到记事易及微博等
  • 2wm.com.cn#二维码.cn立刻有#
  • iidz.cn/zp•照片
  • 搜一搜.cn:Soys.cn易项目网:Exmw.cn
  • Bsss.cn•必上搜索鸣谢.cn:httt.cn/鸣谢
  • 微网话题王wwHTw.cn/名单印发介绍
  • 国搜推介.cn:i3h.cn/5667
  • httt.cn/检索搜一搜.cn•soys.cn建站易:jz1.com
  • 微博客户端@第一建站网#MADV全景#
  • i三好→ 下载app