PHP page appears in Chinese garbled situation, please solve the way
index.php File Code
<title>Message boards</title>
Message boards
$f =fopen ("Text.txt", "A +"); $message =fread ($f, FileSize ("Text.txt")); Fclose ($f); Print $message; ?>
|
Write a message
write1.php Code
<title>Untitled Document</title>
Print "Message board";
?>
write.php Code
<title>Message boards</title>
$name =$_post["name"];
$email =$_post["email"];
$note =$_post["Note"];
if ($name = = "") print Please enter your username! ";
else if ($email = = "") print Please enter the email! ";
else if ($note = = ") print" Please enter a message! ";
Else
{
$file =fopen ("Text.txt", "A +");
$time =date ("F J, Y, g:i a");
$main = "User: $name $time
Message: $note
";
$write =fwrite ($file, $main);
Fclose ($file);
Print " Submit Success!
";
}
?>
Continue message
View Message
My 3 files are gb2312 encoded Ah, but the text box input Chinese will still appear garbled
With Utf-8 encoding, the code in the Chinese garbled, but the text box input Chinese will not, for interpretation.
------Solution--------------------
Save Notepad as an encoding, consistent with the charset in the file