CNT is a UTF-8 encoded page that passes over the address of the parameter,
Convert with Iconv and mb_convert_encoding
$cnt =iconv ("Utf-8", "Gb2312//ignore", $_get[' cnt]);
$cnt =mb_convert_encoding ($_get[' cnt '], "gb2312", "utf-8");
But Var_dump ($cnt) display of Chinese characters have become a box, ask how to convert?
Reply to discussion (solution)
What format is your file encoded in?
If it's gb2312,
Plus: Header ("content-type:text/html;charset=gb2312");
Then Var_dump ()
I added one to the head.
The same is true for the display or the box
$cnt =iconv ("Utf-8", "Gb2312//ignore", $_get[' cnt]);
$cnt =mb_convert_encoding ($_get[' cnt '], "gb2312", "utf-8");
Are the squares shown in both of these ways?
Your file code is also gb2312.
I am a novice, you say the file encoding is not this charset=gb2312? That's gb2312.
Save file as ANSI format
First, determine what's coming in.
echo base64_encode ($_get[' cnt ');
Post the results to help you analyze
Output the original variable look to see if there is a problem.
I am a novice, you say the file encoding is not this charset=gb2312? That's gb2312.
Oh, not this, CharSet just declares the code, I say the actual file encoding. Many Ides or editors can see the encoding of the file. For example, notepad++