aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/net/puny.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/net/puny.el b/lisp/net/puny.el
index 5874871a90d..389a6dc2700 100644
--- a/lisp/net/puny.el
+++ b/lisp/net/puny.el
@@ -32,7 +32,11 @@
32(defun puny-encode-domain (domain) 32(defun puny-encode-domain (domain)
33 "Encode DOMAIN according to the IDNA/punycode algorith. 33 "Encode DOMAIN according to the IDNA/punycode algorith.
34For instance, \"fśf.org\" => \"xn--ff-2sa.org\"." 34For instance, \"fśf.org\" => \"xn--ff-2sa.org\"."
35 (mapconcat 'puny-encode-string (split-string domain "[.]") ".")) 35 ;; The vast majority of domain names are not IDNA domain names, so
36 ;; add a check first to avoid doing unnecessary work.
37 (if (string-match "\\'[[:ascii:]]*\\'" domain)
38 domain
39 (mapconcat 'puny-encode-string (split-string domain "[.]") ".")))
36 40
37(defun puny-encode-string (string) 41(defun puny-encode-string (string)
38 "Encode STRING according to the IDNA/punycode algorithm. 42 "Encode STRING according to the IDNA/punycode algorithm.