Php functions for obtaining the encoding format of strings
- $ Encode = mb_detect_encoding ($ string, array ("ASCII", 'utf-8', "gb2312'," GBK ", 'big5 ′));
- Echo $ encode;
So that we can know what encoding format it is. In addition, if you want to transcode it, you can refer to the following code:
- If ($ encode = "UTF-8 ″){
- $ String = iconv ("UTF-8", "GBK", $ string );
- }
The PHP file or string encoding format involves a wide range of content. I will introduce it in detail later. Let's talk about this today. I hope it will help you. Articles you may be interested in: learning php string encoding conversion and determining whether php determines whether the string encoding is utf8 function example php determines the two methods of character encoding php automatically detects the content encoding and the conversion code automatically detects the encoding in the content and the conversion function php encoding conversion function (the automatic conversion character set supports array conversion) php function iconv |