An alternative solution for URL-based Chinese garbled characters-encryption and decryption of Chinese Characters

Source: Internet
Author: User

As follows:

 String gzmb = URLDecoder.decode(request.getParameter("gzmb"), "UTF-8" Stringurl = "/wlzh/queryPageList.action?accountO.zt=1&accountO.gzmb="+gzmbJiami+"&accountO.accountIsYx=1";

We can see that decoding is successful. However, the final result is that all the accounts are selected, and the account corresponding to the work target is not selected.

Here, I immediately thought of URL Chinese garbled characters, so I decoded them in the background. But I don't know why. I can't do it in several ways. Here I think of the previous method, through the js two encoding, restructuring the URL. So in the background, I will pass out the work goal, and then re-build the URL through the js Code twice. When I did this, I found that this was not the beginning? In this case, why do we need to decode the first step? Can it be passed directly? You can also remove the decoding in step 1. During the test, ie7 or above, Firefox and Google, but ie6 is not allowed (why is this unknown? ). Here I can only think of one solution, using form for processing. Although it can be successful, this is a last resort.

"". After work, I suddenly came up with an alternative method in the car-encrypting the work target in the background, assigning a value to the url, and then performing decryption on the other side. As follows:

           String gzmb= URLDecoder.decode(request.getParameter("gzmb") ==  ? "" : request.getParameter("gzmb"), "utf-8"        String gzmbJiami =        Stringurl = "/wlzh/queryPageList.action?accountO.zt=1&accountO.gzmb="+gzmbJiami+"&accountO.accountIsYx=1";

 

Perform decryption over there

 String gzmbJiemi =  PageResultInfo<Account_Bean>pageResultInfo = service.queryAccountPageResultBy(accountO , pageInfo,user);

The value of gzmb is as follows:

 

Note: DecodeUtils is a powerful tool for encryption and decryption.

What we provide here is not an advanced technology, but an alternative solution. This tells me,

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.