What are the encoding modes?

Source: Internet
Author: User
What encoding methods do you need to pay attention? At last, this post was edited by shendaowu from 2013-04-0619: 11: 46 to contact such a long-time webpage design. Many coding methods have been involved. But today I encountered another garbled code, so I had to search for it and solve it. The following lists the encoding methods I know: Where are the encoding methods?
At the end of this post, shendaowu edited the webpage design for such a long period of time at 19:11:46 on, and met a lot of coding-related things. But today I encountered another garbled code, so I had to search for it and solve it.
Here are the encoding methods I know:
(Notify the browser of the decoding method on this page)
Encoding method for saving a document
Database encoding method (set when defining a database or table)
SQL statement encoding method (SET by "SET NAMES UTF8)

What is the final encoding method? In this case:
A static page transfers data from a text data box to another php page through the get method. This php page places the data in an insert statement and runs this SQL statement.
What is the encoding method of this query statement? Is it static page encoding, dynamic page encoding, or something else? Anyway, I set all to UTF-8, successfully inserted, no garbled. However, the problem is that the "set names UTF8" setting is required for each insert. how can we SET UTF8 to the default encoding method of SQL statements?

What else do we need to pay attention to the encoding method?
------ Solution --------------------
All "encoding methods" are based on the output page.

Mysql has the adaptive "encoding" function (it is not clear to other databases), that is, if you ask him to return the encoding, he will return the encoding.

------ Solution --------------------
The principle is: coding is required for almost every IO.
Loading php is one time, because the system/web server and php are two encodings.
Php output. the client system/browser and output characters are two encodings.
Read/write files, read/write databases, include ...... And so on.
------ Solution --------------------
I would like to mention a few more easily overlooked
Cookies. this is unlikely, but you should pay attention to it.
Session. I didn't test how to use a session together with two php codes. try again.
Sending and receiving, such as curl, socket, and API
Interaction with other languages

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.