import std.array : appender;
auto w = appender!string();
pctEncodeTo("a b+", Component.Query, w);
assert(w.data == "a%20b+"); // space encoded, '+' preserved in RFC modepctEncodeTo
Write percent-encoded representation of s for component comp to dst.
Leaves unreserved characters untouched and also leaves component-allowed reserved characters as-is; all other code points are UTF-8 encoded and emitted as %HH sequences.
This overload avoids intermediate string allocation by writing directly to an output range.
Parameters
s | Input string to encode. |
comp | URI component whose encoding rules apply. |
dst | Output range that receives the encoded bytes. |