All pastes #833423 Raw Edit

Someone

public text v1 · immutable
#833423 ·published 2007-12-27 06:05 UTC
rendered paste body
void replace_hex_with_ascii(char * string) {

	int i = 0;
	int ii = 0;
	int length = strlen(string);

	char code[5], *end;
	code[0] = '0';
	code[1] = 'x';
	code[4] = 0;

	for (i = 0; i < length; i++) {
		if (string[i] == '%') {
			code[2] = string[i+1];
			code[3] = string[i+2];
			string[i] = strtol(code, &end, 16);
			for (ii = ++i; ii < length; ii++) {
				string[ii] = string[ii+2];
			}
			length -= 2;
		}
	}
}