Function: puny-encode-domain

puny-encode-domain is an autoloaded and byte-compiled function defined in puny.el.gz.

Signature

(puny-encode-domain DOMAIN)

Documentation

Encode DOMAIN according to the IDNA/punycode algorithm.

For instance, "fśf.org" => "xn--ff-2sa.org".

Source Code

;; Defined in /usr/src/emacs/lisp/net/puny.el.gz
(defun puny-encode-domain (domain)
  "Encode DOMAIN according to the IDNA/punycode algorithm.
For instance, \"fśf.org\" => \"xn--ff-2sa.org\"."
  ;; The vast majority of domain names are not IDNA domain names, so
  ;; add a check first to avoid doing unnecessary work.
  (if (string-match "\\`[[:ascii:]]+\\'" domain)
      domain
    (mapconcat #'puny-encode-string (split-string domain "[.]") ".")))