How to convert UTF-8 to gb2312cnt is a UTF-8 encoded webpage parameter passed through the address. iconv and mb_convert_encoding are used to convert $ cnt = iconv ("UTF-8", "gb2312 // IGNORE ", $ _ GET ['cnt ']); how to convert UTF-8 to gb2312
Cnt is a UTF-8 encoded URL-based parameter,
Convert using iconv and mb_convert_encoding
$ Cnt = iconv ("UTF-8", "gb2312 // IGNORE", $ _ GET ['cnt ']);
However, the Chinese characters displayed by var_dump ($ cnt) are all changed into boxes. how can this problem be converted? Share:
------ Solution --------------------
What is the encoding format of your file?
For gb2312
Add: header ("content-type: text/html; charset = gb2312 ");
Then var_dump ()
------ Solution --------------------
$ Cnt = iconv ("UTF-8", "gb2312 // IGNORE", $ _ GET ['cnt ']);
Are squares displayed in both ways?
Is your file encoded as gb2312.
------ Solution --------------------
Save the file as ANSI
------ Solution --------------------
First determine what is passed in
Echo base64_encode ($ _ GET ['cnt ']);
Paste the result to help you analyze it
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service