encodeComponent

Encodes the UTF-8 string uriComponent into a URI and returns that URI. Any character not a letter, digit, or one of -_.!~*'() is escaped.

string
encodeComponent
(
Char
)
(
scope const(Char)[] uriComponent
)
if ()

Examples

assert("!@#$%^&*(".encodeComponent == "!%40%23%24%25%5E%26*(");
assert("<>.@.™".encodeComponent == "%3C%3E.%40.%E2%84%A2");
assert("foo/&".encodeComponent == "foo%2F%26");
assert("dläng röcks".encodeComponent == "dl%C3%A4ng%20r%C3%B6cks");
assert("dlang+rocks!".encodeComponent == "dlang%2Brocks!");

Meta