Home>Article>Backend Development> How to convert php string to utf8 encoding

How to convert php string to utf8 encoding

藏色散人
藏色散人 Original
2020-09-07 09:52:27 2967browse

How to convert php string to utf8 encoding: first use the "mb_detect_encoding" method to automatically identify the string encoding; then use the "mb_convert_encoding" function to convert it into the international standard encoding "utf-8".

How to convert php string to utf8 encoding

Recommended: "PHP Video Tutorial"

When using mb_convert_encoding, you must first know the character encoding. If the encoding is wrong It will be garbled. Use mb_detect_encoding to automatically identify the string encoding and convert it to the international standard encoding utf-8 encoding.


      

mb_convert_encoding — Convert character encoding

mb_detect_encoding — Detect character encoding

The above is the detailed content of How to convert php string to utf8 encoding. For more information, please follow other related articles on the PHP Chinese website!

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