The curl translation URL is a unicode Code and is parsed by the JavaScript code at the front end.

Source: Internet
Author: User

When the query string is used in the url, the square question is translated and some related information is checked. Basically, the server that uses js is used. encode (); server. decode (); Use the url for sending and receiving respectively.

However, you may encounter curl sending and html receiving problems. So I want to translate all the parameter strings into unicode codes on the curl side and parse them through js on the html page.

The specific method is as follows:

Write the following function on the curl side to convert the string to a decimal unicode code and identify it:

{Method private {encodestrtounicode STR: string}: String
Let result: String = ""
{For I: Int = 0 below Str. Size do
Let Baz: Char = {Str. Get I}
Set result = Result & ":" & {format "% d", Baz}
}
{Return result}
}

The parsing code is as follows:

 

Function unicode2ostr (STR )...{
VaR Re =/: [Da-fa-F]... {1, 5}/ig;
VaR arr = Str. Match (re );
If (arr = null) return ("");
For (var I = 0; I <arr. length; I ++ )...{
Arr [I] = String. fromCharCode (arr [I]. replace (/:/g ,""));
}
Return (arr. toString (). replace (/,/g ,""))
}

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.