MCPcopy Create free account
hub / github.com/bk138/multivnc / url_encode

Function url_encode

src/DebugReportEmail.cpp:16–37  ·  view source on GitHub ↗

https://stackoverflow.com/a/17708801/361413 TODO convert to wx-only

Source from the content-addressed store, hash-verified

14// https://stackoverflow.com/a/17708801/361413
15// TODO convert to wx-only
16static string url_encode(const string &value) {
17 ostringstream escaped;
18 escaped.fill('0');
19 escaped << hex;
20
21 for (string::const_iterator i = value.begin(), n = value.end(); i != n; ++i) {
22 string::value_type c = (*i);
23
24 // Keep alphanumeric and other accepted characters intact
25 if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') {
26 escaped << c;
27 continue;
28 }
29
30 // Any other characters are percent-encoded
31 escaped << uppercase;
32 escaped << '%' << setw(2) << int((unsigned char) c);
33 escaped << nouppercase;
34 }
35
36 return escaped.str();
37}
38
39bool DebugReportEmail::DoProcess()
40{

Callers 1

DoProcessMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected