Hi,
In FormDataBuilder, it has a method encodeStringAsFormData which transcode
the form data for form submission (e.g. replace ' ' with '+').
Can you please tell me if there is any code in Webkit which does the
opposite (e.g. convert '+' back to ' ')?
Thank you.
void FormDataBuilder::encodeStringAsFormData(Vector<char>& buffer, const
CString& string)
{
static const char hexDigits[17] = "0123456789ABCDEF";
// Same safe characters as Netscape for compatibility.
static const char safeCharacters[] = "-._*";
// http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.1
unsigned length = string.length();
for (unsigned i = 0; i < length; ++i) {
unsigned char c = string.data()[i];
if ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' &&
c <= '9') || strchr(safeCharacters, c))
append(buffer, c);
else if (c == ' ')
append(buffer, '+');
else if (c == '\n' || (c == '\r' && (i + 1 >= length ||
string.data()[i + 1] != '\n')))
append(buffer, "%0D%0A");
else if (c != '\r') {
append(buffer, '%');
append(buffer, hexDigits[c >> 4]);
append(buffer, hexDigits[c & 0xF]);
}
}
}
_______________________________________________
webkit-help mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-help