Home >Backend Development >PHP Tutorial >Solution to Chinese garbled POST in IE browser - PHP implementation

Solution to Chinese garbled POST in IE browser - PHP implementation

WBOY
WBOYOriginal
2016-07-29 09:08:461581browse

Under the IE browser, the POST data contains Chinese characters, which will become garbled after being obtained in the background. The solution is as follows:

$keys  = $_REQUEST['keys'];


if ($keys != '') {
    $encode = mb_detect_encoding ($keys, array("ASCII", "UTF-8", "GB2312", "GBK", "BIG5"));
    if ($encode != "UTF-8") {
        $keys = iconv ("gb2312", "UTF-8", $keys);
    }
}

Reference: http://blog.sina.com.cn/s/blog_703bcf7c0100s6vb. html

The above introduces the solution to the Chinese garbled POST under IE browser - PHP implementation, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn