punyEncode

Encode the input string using the Punycode algorithm.

Punycode is used to encode UTF domain name segment. A Punycode-encoded segment will be marked with "xn--". Each segment is encoded separately. For instance, if you wish to encode "☂.☃.com" in Punycode, you will get "xn--m3h.xn--n3h.com".

In order to puny-encode a domain name, you must split it into its components. The following will typically suffice:

auto domain = "☂.☃.com";
auto encodedDomain = domain.splitter(".").map!(punyEncode).join(".");
pure @safe
string
punyEncode
(
string input
)

Meta