php Chinese character encoding conversion method: 1. Use the "string iconv()" method to convert; 2. Use the "mb_convert_encoding" method to convert; 3. Use the "mb_detect_encoding" method to convert.
PHP Video Tutorial》
1.iconv
string iconv (string $in_charset, string $out_charset, string $str)First parameter: content Original encoding
Second parameter: Target encoding
Third parameter: String to be converted
$filename='我爱你中国';$filename = iconv('gbk','utf-8',$filename);
Analysis: Convert $filename from gbk to utf82.
mb_convert_encoding
string mb_convert_encoding ( string $str , string $to_encoding [, mixed $from_encoding ] )The first parameter: the string to be processed
Second parameter: target encoding
Third parameter: original encoding of content
$filename='我爱你中国';$filename = mb_convert_encoding($filename,'GBK','UTF-8');
Analysis: Convert $filename from utf8 to gbk3.
mb_detect_encodingView character encoding
$filename='我爱你中国';$encode = mb_detect_encoding($filename, array("ASCII","UTF-8","GB2312","GBK","BIG5"));echo $encode;die;
The above is the detailed content of PHP Chinese character encoding conversion method. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Zend Studio 13.0.1
Powerful PHP integrated development environment

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version
Recommended: Win version, supports code prompts!

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool
