Home > Backend Development > PHP Tutorial > Method (function) to parse php to obtain the encoding format of a string_PHP tutorial

Method (function) to parse php to obtain the encoding format of a string_PHP tutorial

WBOY
Release: 2016-07-21 15:04:23
Original
869 people have browsed it

If you don’t know the encoding format of the string, you can check this character like this:
$encode = mb_detect_encoding($string, array("ASCII",'UTF-8′,"GB2312′," GBK",'BIG5′));
echo $encode;
This way you can know what encoding it is. You can also transcode it in subsequent operations:
if ($encode = = “UTF-8″){
$string = iconv("UTF-8″,"GBK",$string);
}

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/327761.htmlTechArticleIf you don’t know the encoding format of the string, you can check this character like this: $encode = mb_detect_encoding( $string, array("ASCII",'UTF-8′,"GB2312′,"GBK",'BIG5′)); ec...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template