]> code.delx.au - gnu-emacs/commitdiff
Fix puny-encoding all-non-ASCII domains
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 28 Dec 2015 23:07:50 +0000 (00:07 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 28 Dec 2015 23:07:50 +0000 (00:07 +0100)
* puny.el (puny-encode-string): Fix the all-non-ASCII encoding case.

lisp/net/puny.el

index a16e3a07706834aff81e372b41f50664a7daabf0..d96c6c22196ae04700545432b4a65ce4de4f2ba6 100644 (file)
@@ -47,7 +47,11 @@ For instance, \"bücher\" => \"xn--bcher-kva\"."
                            string)))
     (if (= (length ascii) (length string))
         string
-      (concat "xn--" ascii "-" (puny-encode-complex (length ascii) string)))))
+      (concat "xn--"
+              (if (null ascii)
+                  ""
+                (concat ascii "-"))
+              (puny-encode-complex (length ascii) string)))))
 
 (defun puny-decode-domain (domain)
   "Decode DOMAIN according to the IDNA/punycode algorith.