
Originally Posted by
wysota
You can iterate through the string and convert all %xx matches to their hexadecimal value.
So..... i can read cookie on window .... i hope is run on Mac & Linux ...
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define SPC_BASE16_TO_10(x) (((x) >= '0' && (x) <= '9') ? ((x) - '0') : \
(toupper((x)) - 'A' + 10))
{
char *newstrings = lop.data();
char *resulter = spc_decode_url(newstrings);
QString resoap
= salt.
replace("+",
" ");
return resoap;
}
/* found http://www.oreillynet.com/pub/a/network/excerpt/spcookbook_chap03/index2.html */
char *spc_decode_url(const char *url) {
char *out, *ptr;
const char *c;
if (!(out = ptr = strdup(url))) return 0;
for (c = url; *c; c++) {
if (*c != '%' || !isxdigit(c[1]) || !isxdigit(c[2])) *ptr++ = *c;
else {
*ptr++ = (SPC_BASE16_TO_10(c[1]) * 16) + (SPC_BASE16_TO_10(c[2]));
c += 2;
}
}
*ptr = 0;
if ( strlen(url) == (ptr - out)); /* does not include null byte */
return out;
}
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#define SPC_BASE16_TO_10(x) (((x) >= '0' && (x) <= '9') ? ((x) - '0') : \
(toupper((x)) - 'A' + 10))
QString Url_Decode( QString indata )
{
QByteArray lop = indata.toAscii();
char *newstrings = lop.data();
char *resulter = spc_decode_url(newstrings);
QString salt = QString("%1").arg(resulter);
QString resoap = salt.replace("+"," ");
return resoap;
}
/* found http://www.oreillynet.com/pub/a/network/excerpt/spcookbook_chap03/index2.html */
char *spc_decode_url(const char *url) {
char *out, *ptr;
const char *c;
if (!(out = ptr = strdup(url))) return 0;
for (c = url; *c; c++) {
if (*c != '%' || !isxdigit(c[1]) || !isxdigit(c[2])) *ptr++ = *c;
else {
*ptr++ = (SPC_BASE16_TO_10(c[1]) * 16) + (SPC_BASE16_TO_10(c[2]));
c += 2;
}
}
*ptr = 0;
if ( strlen(url) == (ptr - out)); /* does not include null byte */
return out;
}
To copy to clipboard, switch view to plain text mode
Bookmarks