Realization of Server.urlencode in ASP in ANSI C

xiaoxiao2021-03-06  81

If the URL is submitted to the HTTP server, if the URL contains Chinese characters, I hope that the ASP page is still normal Chinese characters, not a garbled approach to putting the URL string eNCode, before someone wrote in the VC. See http://blog.9cbs.net/zhengyun_ustc/archive/2002/05/20/12654.aspx But it can only run in VC, there is a certain limit, so I have rewritten. The code is as follows:

Inline Byte tohex (const byte & x)

{

RETURN X> 9? x 55: x 48;

}

Urlencode (lpbyte in, lpbyte out)

{

IF (OUT)

{

While (* in)

{

IF (isalNum (* in))

* OUT = * in;

Else

IF (Isspace (* in))

* OUT = ' ';

Else

{

* OUT = '%';

* OUT = tohex (* in >> 4);

* OUT = tohex (* IN% 16);

}

IN ;

}

* OUT = '/ 0';

}

Return 1;

}

What is the bug that everyone will finish.

转载请注明原文地址:https://www.9cbs.com/read-93804.html

New Post(0)