All Chinese characters in mobile phone delivery search are changed to "???" Parameters ????" "??? ·? ± ??????" "??? ·??"

Source: Internet
Author: User
All Chinese characters submitted for mobile phone search are changed to "???" Parameters ????" "??? ·? ± ??????" "??? ·??" This post was last edited by default7 from 2012-12-2313: 10: 17, which is a strange phenomenon: (1) use a mobile phone for keyword search, all Chinese characters are changed to "??? · All Chinese words submitted by mobile phone search are converted into "???" Parameters ????" "??? ·? ± ??????" "??? ·??"
This post was last edited by default7 at 13:10:17 on Strange phenomenon:
(1) use a mobile phone to search for keywords. all Chinese characters are changed to "??? ·??" And Latin characters.
(2) use is_utf8 to detect that $ _ GET [kw] returns UTF-8 encoding.
(3) Direct echo $ _ GET [kw] at the beginning of the mobile phone access file... Computer access is not

Related configuration:
(1) database type MyISAM, Table character set utf8_general_ci, and field kw character set utf8_general_ci
(2) PHP Version: PHP Version 5.2.17, CGI/fast CGI
(3) System Linux sasin 2.6.32.36-hardened #9 SMP Tue Mar 29 09:29:20 PDT 2011 x86_64
(4) mobile phone information:
HTTP_ACCEPT_ENCODING = gzip
HTTP_ACCEPT_LANGUAGE = zh-CN
HTTP_USER_AGENT = Mozilla/5.0 (Linux; U; Android 2.3; zh-cn; HTC Build/GRJ90) UC AppleWebKit/534.31 (KHTML, like Gecko) Mobile Safari/534.31
HTTP_ACCEPT = application/xml, application/vnd.wap.xhtml + xml, application/xhtml + xml, text/html; q = 0.9, text/plain; q = 0.8, image/png, text/vnd. wap. wml; q = 0.6, */*; q = 0.5, UC/145, plugin/1
REMOTE_PORT = 49279
REQUEST_METHOD = GET
(5) mobile browser UC: 8.7.2.214 Android



Example search keywords:
Reference
GUANGZHOU-> ????????? ·??
Shenzhen-> ??? ·? ± ??????
BEIJING-> ??????? Parameters ????



PHP function is_utf8 (), from PHP official website

function is_utf8($str) {
    $c=0; $b=0;
    $bits=0;
    $len=strlen($str);
    for($i=0; $i<$len; $i++){
        $c=ord($str[$i]);
        if($c > 128){
            if(($c >= 254)) return false;
            elseif($c >= 252) $bits=6;
            elseif($c >= 248) $bits=5;
            elseif($c >= 240) $bits=4;
            elseif($c >= 224) $bits=3;
            elseif($c >= 192) $bits=2;
            else return false;
            if(($i+$bits) > $len) return false;
            while($bits > 1){
                $i++;
                $b=ord($str[$i]);
                if($b < 128 || $b > 191) return false;
                $bits--;
            }
        }
    }
    return true;
}






------ Solution --------------------
Let's start with a language declaration header.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.