PHP page appears in Chinese garbled situation, please solve the way, how to solve

Source: Internet
Author: User
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
  • Contact Us

    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

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.