Questions about text garbled characters in the website Test

Source: Internet
Author: User
The website test text is garbled. my database character is GB2312_CHINESE_BINfun.php. The character set is gb2312, except for the PHP code-only page, after each page is changed, the text display of the gb2312 webpage code is correct. However, in pure PHP code, the text in the output table is garbled. how can this problem be solved? ------ Solution -------------------- set the header on the php page (& q website test text display garbled problem
The character of my database is GB2312_CHINESE_BIN.
The character set for fun. php is gb2312.
Except for pages with pure PHP code, each page is changed to gb2312
The text display of the webpage code is correct,
But in pure PHP code, the text in the output table will show garbled characters. how can this problem be solved?

------ Solution --------------------
Set header ("Content-type: text/html; charset = gbk") on the php page. select gbk for encoding when saving the php file.
------ Solution --------------------
Yes, the program file must also be saved as gbk... The problem I encountered was to unify everything into utf8, but many times the code file is not stored in utf8, and garbled characters may occur.
------ Solution --------------------
Well. When retrieving data. Add mysql_query ("set names 'gbk '");
------ Solution --------------------
Discussion

Reference:
Set header ("Content-type: text/html; charset = gbk") on the php page. select gbk for encoding when saving the php file.

Header ("Content-type: text/html; charset = gbk ");
...?>

Is it like this ??

------ Solution --------------------
PHP code
  
------ Solution --------------------
Discussion
But in pure PHP code, the text in the output table will show garbled characters. how can this problem be solved?

------ Solution --------------------
Discussion
Set header ("Content-type: text/html; charset = gbk") on the php page. select gbk for encoding when saving the php 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.