關於網頁中十六進位解碼問題

來源:互聯網
上載者:User

標籤:

關於網頁中十六進位解碼問題

#include<stdio.h>//%D6  %D0  %B9  %FA  4個位元組 8  32//%D6   //1101  13   0110  6   =13*16+6//%D0   //1101  13  0000  0    13*16//-55// 10    11    12     13//‘A‘ 65  B 66 C  67  D 68void main1(){    char strx[7] = "%D6%D0";    char str[3] = { 0 };    //str[0]= 214;//‘D‘ ‘6‘  13*16+6    //str[1]=208;//‘D‘ ‘0‘   13*16+0    str[0] = (‘D‘ - 55) * 16 + ‘6‘ - 48;    str[1] = (‘D‘ - 55) * 16 + ‘0‘ - 48;    printf("%s", str);    getchar();}char* change(char *str){    char *tempstr = malloc(strlen(str) + 1);//strlen    //memset(tempstr, 0, sizeof(str) + 1);    int x=0, y=0;    char assii_1, assii_2;    while (tempstr[x])    {        if ((tempstr[x]=str[y]) ==‘%‘)        {            //y+1 y+2            if (str[y+1]>=‘A‘)            {                assii_1 = str[y + 1] - 55;            }             else            {                assii_1 = str[y + 1] - 48;            }            if (str[y + 2] >= ‘A‘)            {                assii_2= str[y + 2] - 55;            }            else            {                assii_2 = str[y + 2] - 48;            }            tempstr[x] = assii_1 * 16 + assii_2;            y += 2;        }        x++;        y++;    }    tempstr[x] = ‘\0‘;    return tempstr;}void main(){    char str[128] = "%D6%DC%C8%F0%B8%A3";    printf("%s", change(str));    system("pause");}

 

關於網頁中十六進位解碼問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.