[Software Test _HW1] Remember the experience of debugging a bug

Source: Internet
Author: User

At the end of last semester web development of the big job, asked to write a wanted to manage the system, the basic function to realize that is nothing more than database additions and deletions to check. It's easy to achieve, but it's been a long time in some detail. One of them is the Chinese garbled problem. The main concerns are two areas:

One, unable to insert the Chinese data in the MySQL database, once the Chinese data is involved, it will become garbled in the database. After query discovery is due to the problem of the default encoding setting of the database, the encoding of the corresponding table and column is set to UTF-8.

Second, the page display garbled.

1. Through <%@ page language="java" import="java.util.*" contenttype= "text/html"; Charset=utf-8 "%> The encoding of the specified page

2. The background accepts Chinese parameters using the new String (Str.getbytes ("iso-8859-1"), "UTF-8") for encoding conversion.

Through this debugging bug experience, I know that encountered problems first need to analyze the cause of the problem, only to know the reason to solve, learning to analyze the source of the problem is far more important than solving the problem.

And the reason for the garbled problem is that the coding of the program is not the same as the coding of the programmer, so the solution to this problem only needs to be programmed to tell the programmer the code to the program can be, the above methods to solve garbled problem can be said to be a process of declaring code, that is, the ultimate solution to garbled problem is transcoding.

[Software Test _HW1] Remember the experience of debugging a bug

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.