emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 8c1e16b 1/2: Small puny.el fix


From: Glenn Morris
Subject: [Emacs-diffs] master 8c1e16b 1/2: Small puny.el fix
Date: Wed, 1 Mar 2017 20:36:29 -0500 (EST)

branch: master
commit 8c1e16bee492f7f8776805cfc051801e3da5cd20
Author: Glenn Morris <address@hidden>
Commit: Glenn Morris <address@hidden>

    Small puny.el fix
    
    * lisp/net/puny.el (puny-decode-string-internal):
    Handle strings with no ascii parts.  (Bug#23688)
---
 lisp/net/puny.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/net/puny.el b/lisp/net/puny.el
index c718d95..bdd59be 100644
--- a/lisp/net/puny.el
+++ b/lisp/net/puny.el
@@ -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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]