Encoding and conversion of the returned values of online payment APIs for Online Banking

Source: Internet
Author: User

Today, I debugged the online interface, and found that the Chinese characters (such as the payment bank and payment status) in the returned values are all garbled. I wanted to refer to the encoding problem. When I called customer service, the technology was not working, the so-called 7*24-hour service means that a customer service can answer the phone number within 7*24 hours (what is the use of the phone number? The problem cannot be solved). It is depressing.

 

Google is still the best teacher. I searched for it and found that someone said the Returned Code was gb2312, and someone said it was GBK. So I had to try it all. It turns out that it was GBK.

So I wrote a code segment to process the payment result data from online post of online banking:

 

 

Streamreader sr = new streamreader (request. inputstream, encoding. getencoding (936 ));
String query = Sr. readtoend ();
System. Collections. Specialized. namevaluecollection reqresult = httputility. parsequerystring (query, encoding. getencoding (936 ));

V_pstring = reqresult ["v_pstring"];
V_pmode = reqresult ["v_pmode"];

 

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.