MCPcopy Create free account
hub / github.com/BZFlag-Dev/bzflag / url_encode

Function url_encode

src/common/TextUtils.cpp:308–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306 }
307
308 std::string url_encode(const std::string& text) {
309 char hex[5];
310 std::string destination;
311 for (size_t i = 0; i < text.size(); ++i) {
312 unsigned char c = text[i];
313 if (isAlphanumeric(c)) {
314 destination += c;
315 }
316 else if (isWhitespace(c)) {
317 destination += '+';
318 }
319 else {
320 destination += '%';
321 sprintf(hex, "%-2.2X", c);
322 destination.append(hex);
323 }
324 }
325 return destination;
326 }
327
328
329 std::string escape(const std::string& text, char escaper) {

Callers 5

checkEchosMethod · 0.50
addMeMethod · 0.50
buildHTMLPlayerMethod · 0.50
urlEncodeMethod · 0.50
bz_urlEncodeFunction · 0.50

Calls 4

isAlphanumericFunction · 0.70
isWhitespaceFunction · 0.70
sizeMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected