Zhang Xiaohong: Experiences in JSP garbled Solutions

Source: Internet
Author: User

Finally, we solved the annoying garbled problem of the news system, which is much more troublesome than the bookstore system. The bookstore system only needs to add three lines of code in front of each page. However, the news system does not work. This may be because the database of the bookstore system is ACCESS, while that of the news system is MYSQL. To sum up, it is the coordination of code in several places. coordination is not necessarily uniform, and I have tried it. The theme is the coordination of these places.

1. MYSQL encoding settings. See another log article. I don't know. I set it to GB2312, or set it to another place.

2. URL string used to connect to the database. The GB2312 statement used at the beginning does not work. garbled code is used to submit the form to the database (the two statements above the page are set to GB2312 at this time ). Then, the URL string is set to 8859-1, and the database is Chinese. (What is the cause? I don't know. It may be related to MYSQL encoding)

3. Three rows on the page. The three rows are set to GB2312, but the page displays an error. Only the row of the request can be displayed. (Set the other two to GB2312)

4. Statements for inputting data into the database. (You can change the encoding and coordination. But I did not change it here. I directly ADD the data to the database .)

5. The data is displayed after it is put forward from the database and can also be encoded. I have coded the objective existence and the result shows the correct Chinese characters. OK.

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.