]> git.eshelyaron.com Git - emacs.git/commitdiff
Small puny.el fix
authorGlenn Morris <rgm@gnu.org>
Thu, 2 Mar 2017 01:35:41 +0000 (20:35 -0500)
committerGlenn Morris <rgm@gnu.org>
Thu, 2 Mar 2017 01:35:41 +0000 (20:35 -0500)
* lisp/net/puny.el (puny-decode-string-internal):
Handle strings with no ascii parts.  (Bug#23688)

lisp/net/puny.el

index c718d958be1fcbfc4c6824b1cc4a7bbe2a3753fe..bdd59be070a28b3dcdf4f240c57cc2cc565748f9 100644 (file)
@@ -150,10 +150,12 @@ For instance \"xn--bcher-kva\" => \"bücher\"."
 (defun puny-decode-string-internal (string)
   (with-temp-buffer
     (insert string)
-    (goto-char (point-max))
-    (search-backward "-" nil (point-min))
-    ;; The encoded chars are after the final dash.
-    (let ((encoded (buffer-substring (1+ (point)) (point-max)))
+    ;; The encoded chars are after any final dash, else the whole string.
+    (let ((encoded (buffer-substring
+                    (if (search-backward "-" nil 'move)
+                        (1+ (point))
+                      (point))
+                    (point-max)))
           (ic 0)
           (i 0)
           (bias puny-initial-bias)