The example in this article describes the usage of the character encoding conversion function in PHP and is shared with everyone for your reference. The specific implementation method is as follows:
Generally speaking, in web programs, especially when it comes to the process of reading out the database, the most annoying thing is often the problem of character encoding. PHP4.0.6 or above provides mb_convert_encoding to conveniently convert the encoding.
The details are as follows:
/* Convert EUC-JP to UTF-7 */
$str = mb_convert_encoding($str, "UTF-7", "EUC-JP");
/* Auto detect encoding from JIS, eucjp-win, sjis-win, then convert str to UCS-2LE */
$str = mb_convert_encoding($str, "UCS-2LE", "JIS, eucjp-win, sjis-win");
/* "auto" is expanded to "ASCII,JIS,UTF-8,EUC-JP,SJIS" */
$str = mb_convert_encoding($str, "EUC-JP", "auto");
?>
For example, if you want to convert a gb2312 string to utf-8, you can use the following method:
I hope this article will be helpful to everyone’s PHP programming design.
You are talking about URL encoding, right?
PHP actually has functions in this area:
So you only need to use the urldecode() function That's it.
Thank you!
Open it with your browser and see what code it automatically recognizes