请问如何转化URL编码?
例如编程实现把
%68%74%74%70%3A%2F%2F%77%77%77%2E%67%6F%6F%67%6C%65%2E%63%6F%6D
转化成
http://www.google.com这种形式是什么编码?谢谢

解决方案 »

  1.   

    就是asc编码嘛
    inline BYTE toHex(const BYTE &x)
    {
    return x>9?x+55:x+48;
    }void 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';
    }
    }
      

  2.   

    CString szData = "%68%74%74%70%3A%2F%2F%77%77%77%2E%67%6F%6F%67%6C%65%2E%63%6F%6D";
    CString szTemp;
    char buff[100] = {0};
    int i = 0;
    int k = 0;
    while(AfxExtractSubString( szTemp, szData, i, '%'))
    {
    if(!szTemp.IsEmpty ())
    buff[k++] = (char)strtoul(szTemp, NULL, 16);
    i++;
    }
      

  3.   

    UrlUnEscape Function
    msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/shlwapi/path/urlunescape.asp
      

  4.   

    http://dev.csdn.net/article/19/19205.shtm
      

  5.   

    谢谢jiangsheng(蒋晟.Net[MVP]) 这个函数对于纯英文和数字确实可以,但是URL中含有中文字符就不行了,请问该怎么办?谢谢