From 1f591ca64f2409b4c44d7ff239f95bcfa1a568aa Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 28 Dec 2015 02:57:40 +0100 Subject: [PATCH] Further IDNA tweaks (idna-encode-string): Make idna-encode-string safe for non-ASCII use. --- lisp/net/idna.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/net/idna.el b/lisp/net/idna.el index f34fb9c490a..dfaf711c71e 100644 --- a/lisp/net/idna.el +++ b/lisp/net/idna.el @@ -33,7 +33,9 @@ (let ((ascii (seq-filter (lambda (char) (< char 128)) string))) - (concat "xn--" ascii "-" (idna-encode-complex (length ascii) string)))) + (if (= (length ascii) (length string)) + string + (concat "xn--" ascii "-" (idna-encode-complex (length ascii) string))))) (defconst idna-initial-n 128) (defconst idna-initial-bias 72) -- 2.39.5